title: Terraform Azure VM Extension Custom Script from Local Script
body: <p>I'm trying to deploy Azure Windows VM with VM extension by Terraform that will install ADDS role for the Windows VM.</p>
  <p>I have one Powershell script file for the installation named <strong>install_adds.ps1</strong> from my local machine</p>
  <p>The Terraform file of VM Extension as below:</p>
  <pre><code>resource &quot;azurerm_virtual_machine_extension&quot; &quot;main&quot; {
    name                 = &quot;extensionTest&quot;
    virtual_machine_id   = azurerm_virtual_machine.main.id
    publisher            = &quot;Microsoft.Azure.Extensions&quot;
    type                 = &quot;CustomScript&quot;
    type_handler_version = &quot;2.0&quot;
  
    settings = &lt;&lt;SETTINGS
      {
          &quot;commandToExecute&quot;: &quot;powershell.exe ./install_adds.ps1&quot;
      }
  SETTINGS
  }
  </code></pre>
  <p>I have deployed the VM Extension Terraform file but not working</p>
  <p>I think my Terraform file syntax is wrong and the Windows does not run my PowerShell script.</p>
  <p>Any way can run my local PowerShell Script by Terraform VM Extension file?</p>