0
votes

As part of my ARM Template, I need to execute PowerShell script to install Failover cluster windows feature. However, the script run for at least 10 min then fails with following error.

new-azResourceGroupDeployment : 11:18:03 - Resource Microsoft.Compute/virtualMachines/extensions 'DI-ukwest-DB1/extensions' failed with message '{ "status": "Failed", "error": { "code": "ResourceDeploymentFailure", "message": "The resource operation completed with terminal provisioning state 'Failed'.", "details": [ { "code": "VMExtensionProvisioningError", "message": "VM has reported a failure when processing extension 'extensions'. Error message: \"Failed to download all specified files. Exiting. Error Message: The remote server returned an error: (400) Bad Request.\"." } ] } }'

My script is

{
      "type": "Microsoft.Compute/virtualMachines/extensions",
      "name": "[concat(variables('varnodeNamePrefix'),copyindex(1),'/extensions')]",
      "apiVersion": "2017-03-30",
      "location": "[variables('varlocation')]",
      "dependsOn": [
        "[concat(variables('varnodeNamePrefix'),copyindex(1))]"
      ],
      "properties": {
        "publisher": "Microsoft.Compute",
        "type": "CustomScriptExtension",
        "typeHandlerVersion": "1.8",
        "autoUpgradeMinorVersion": true,
        "settings": {
          "fileUris": [
            "https://XXXXXarmtemplets.file.core.windows.net/powershellscripts/sqlcluster/InstallWindowsFeaturs.ps1"
          ]
        },
        "protectedSettings": {
          "commandToExecute": "powershell.exe -ExecutionPolicy Unrestricted -InstallWindowsFeaturs.ps1",
          "storageAccountName": "XXXXXarmtemplets",
          "storageAccountKey": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
        }
      },
      "copy": {
        "name": "WinFeatures",
        "count":"[variables('varvmCount')]"
      }
    }

Thanks

1
No, That is why I added protectedSettings - vinu thomas
oh, ok i'm being silly. also this suggests you need to do -File \"./powershellscripts/sqlcluster/InstallWindowsFeaturs.ps1\" instead of what you are doing - 4c74356b41

1 Answers

0
votes

That error is pretty reliable - the ps1 file can't be downloaded by the extension. I noticed you have "file" .core.windows.net instead of "blob" which is the common use case - so one thing to check...

Also, you can log onto the VM and check the logs, see:

https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-windows#troubleshoot-and-support