I face the following error while deploying my VMs to Az.
At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.
Details:
VMExtensionProvisioningError: VM has reported a failure when processing extension 'CustomScriptExtension'. Error message: "Command execution finished, but failed because it returned a non-zero exit code of: '1'. Command execution may have been interrupted by a VM restart"
More information on troubleshooting is available at https://aka.ms/VMExtensionCSEWindowsTroubleshoot
Check out the troubleshooting guide to see if your issue is addressed: https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment?view=azure-devops#troubleshooting
Task failed while creating or updating the template deployment.
Below is the portion of Custom Script Extension being used:
"condition": "[equals(parameters('templateType'),'domainJoinAndPuppet')]",
"apiVersion": "2015-06-15",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(variables('vmName'),'/CustomScriptExtension')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Compute/virtualMachines/', variables('vmName'))]"
],
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.10",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [ "URL of PS Script 1",
"URL of PS Script2"
]
},
"protectedSettings": {
"commandToExecute": "[variables('agentCommandToExecute')]"
}
}
},
This script sometimes work and sometimes doesn't work at all.