title: Terraform azurerm_virtual_machine_extension, run local PowerShell Script using CustomScriptExtension
body: <p>How to run a local ( without storing to a blob storage account ) PowerShell script in terraform  azurerm_virtual_machine_extension</p>
  
  <p>Folder having </p>
  
  <ol>
  <li>main.tf</li>
  <li><p>install.ps1</p>
  
  <p>resource "azurerm_virtual_machine_extension" "software" {
        name                 = "install-software"
        resource_group_name  = azurerm_resource_group.azrg.name
        virtual_machine_id   = azurerm_virtual_machine.vm.id
        publisher            = "Microsoft.Compute"
        type                 = "CustomScriptExtension"
        type_handler_version = "1.9"</p>
  
  <pre><code>  settings = &lt;&lt;SETTINGS
      { 
        "commandToExecute": "powershell -ExecutionPolicy Unrestricted -File \"install.ps1\""
      } 
      SETTINGS
  } 
  </code></pre>
  
  <p>but failed</p>
  
  <pre><code>[
          {
              "code": "ComponentStatus/StdOut/succeeded",
              "level": "Info",
              "displayStatus": "Provisioning succeeded",
              "message": "Windows PowerShell \r\nCopyright (C) Microsoft Corporation. All rights reserved.\r\n\r\n"
          },
          {
              "code": "ComponentStatus/StdErr/succeeded",
              "level": "Info",
              "displayStatus": "Provisioning succeeded",
              "message": "The argument 'install.ps1' to the -File parameter does not exist. Provide the path to an existing '.ps1' file as an argument to the -File parameter.\r\n"
          }
      ]
  </code></pre></li>
  </ol>
  
  <p>any lead.</p>
  
  <p>Thanks</p>