I have deployed a Customscript Extension to a Windows VM (to add a second Log Analytics Workspace) but the Terraform deployment times out.
When I check the Extensions in the Azure Portal it shows the following:
The script (powershell) works perfectly if run locally on the VM.
The error (Invalid manifest version: 10 for handler Microsoft.Azure.Extensions.CustomScript:2.0.7 in file 0.status) doesn’t appear to give much information as to why it’s failing.
Terraform code:
resource "azurerm_virtual_machine_extension" "MMA_Cust" {
for_each = toset(var.vm_hostname_list)
name = "MSMonitoringAgent_Cust"
virtual_machine_id = azurerm_virtual_machine.gwb-vm[each.key].id
publisher = "Microsoft.Azure.Extensions"
type = "CustomScript"
type_handler_version = "2.0"
depends_on = [azurerm_virtual_machine_extension.MMA]
settings = <<SETTINGS
{
"script": "${base64encode(templatefile("${path.module}/add_2nd_LAW.ps1", {
wsid="<id>",
wsidkey="<key>"
}))}"
}
SETTINGS
}