title: How to run below powershell script inside terraform local-exec
body: <p>I am trying to change the stack of webapp with the help of local-exec provisioner in terraform template. </p>
  
  <pre><code># Create azure Webapp 1
  resource "azurerm_app_service" "webapp1" {
    name                = var.webapp1
    location            = azurerm_resource_group.dev.location
    resource_group_name = azurerm_resource_group.dev.name
    app_service_plan_id = azurerm_app_service_plan.dev.id
    https_only          = "true"
    site_config {
      always_on                 = "true"
      ftps_state                = "FtpsOnly"
      dotnet_framework_version  = "v4.0"
      http2_enabled             = "true"
      min_tls_version           = "1.2"
      use_32_bit_worker_process = "false"
      default_documents = ["hostingstart.html"]
  
    }
   provisioner "local-exec" {
   command =&lt;&lt;EOT  
  $PropertiesObject = @{"CURRENT_STACK" = "dotnetcore"}
  New-AzResource -PropertyObject $PropertiesObject -ResourceGroupName azurerm_resource_group.dev.name -ResourceType Microsoft.Web/sites/config/metadata -ResourceName azurerm_app_service.webapp1.name -ApiVersion 2018-02-01 -Force
  EOT}
  
  </code></pre>
  
  <p>But it is giving me the below error:</p>
  
  <pre><code>azurerm_app_service.webapp1 (local-exec): Executing: ["cmd" "/C" "    $PropertiesObject = @{\r\n    \"CURRENT_STACK\" = \"dotnetcore\"\r\n    }\r\n    New-AzResource -PropertyObject $PropertiesObject -ResourceGroupName azurerm_resource_group.dev.name -ResourceType Microsoft.Web/sites/config/metadata -ResourceName azurerm_app_service.webapp1.name -ApiVersion 2018-02-01 -Force  \r\n"]
  azurerm_app_service.webapp1 (local-exec): '$PropertiesObject' is not recognized as an internal or external command,
  azurerm_app_service.webapp1 (local-exec): operable program or batch file.
  
  
  Error: Error running command '    $PropertiesObject = @{
      "CURRENT_STACK" = "dotnetcore"
      }
      New-AzResource -PropertyObject $PropertiesObject -ResourceGroupName azurerm_resource_group.dev.name -ResourceType Microsoft.Web/sites/config/metadata -ResourceName azurerm_app_service.webapp1.name -ApiVersion 2018-02-01 -Force
  ': exit status 1. Output: '$PropertiesObject' is not recognized as an internal or external command,
  operable program or batch file.
  
  </code></pre>
  
  <p>Any idea how to fix it.</p>