Azure / Azure/azure-quickstart-templates
'Error Code: Conflict' with 'VMExtensionProvisioningError'
- Dominant language
- Bicep
- Stars
- 14.9k
- Forks
- 16.2k
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 6
Description
I am trying to deploy virtual machine via ARM template and Azure Python library. My VM is getting created and custom script actually started executing inside VM as well but always getting 'Error Code: Conflict' with 'VMExtensionProvisioningError'
When I login to the VM and check extension log, I see my script runs well inside the VM and my application is running. The script takes ~10 min to finished execution.
According to documentation, "Error Code : Conflict" caused when VM is not in state to perform operation, does it mean VM was not ready when extension ran via ARM template, then how the script ran fine inside VM.
Error :
=======================
```
Traceback (most recent call last):
File "test_deploy.py", line 47, in
deployment_async_operation.wait()
File "/usr/local/lib/python2.7/dist-packages/msrestazure/azure_operation.py", line 501, in wait
raise self._exception
msrestazure.azure_exceptions.CloudError: Azure Error: DeploymentFailed
Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.
Exception Details:
Error Code: Conflict
Message: {'status': 'Failed', 'error': {'message': "The resource operation completed with terminal provisioning state 'Failed'.", 'code': 'ResourceDeploymentFailure', 'details': [{'message': 'VM has reported a failure when processing extension \'nsxagent\'. Error message: "Finished executing command".', 'code': 'VMExtensionProvisioningError'}]}}`
```
=======================
My ARM Template
=======================
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "West US",
"allowedValues": [
"West US"
],
"metadata": {
"description": "Location of resources"
}
},
"virtualMachineName": {
"type": "string",
"metadata": {
"description": "Virtual machine name"
}
},
"virtualMachineSize": {
"type": "string",
"defaultValue": "Standard_A2",
"allowedValues": [
"Standard_A0",
"Standard_A1",
"Standard_A2",
"Standard_A3",
"Standard_A4"
],
"metadata": {
"description": "Size of the VM"
}
},
"virtualNetworkName": {
"type": "string"
},
"diagnosticsStorageAccountName": {
"type": "string"
},
"subscription_id": {
"type": "string"
},
"storage_acc_rg": {
"type": "string",
"metadata": {
"description": "storage account resource group"
}
},
"nsx_inf_sg": {
"type": "string"
},
"gateway_ip": {
"type": "string"
},
"numberOfInstances": {
"type": "int"
}
},
"variables": {
"vnetId": "[resourceId(concat(parameters('virtualNetworkName'),'-RG'),'Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetId'), '/subnets/', variables('subnetName'))]",
"adminUsername": "*****",
"adminPassword": "*****",
"networkSecurityGroupName": "*****",
"subnetName": "****",
"extension_nsx_install": "[concat('*****')]",
"extension_nsx_bundle": "[concat('*****')]",
"command_to_execute": "[concat('****)]"
},
"resources": [
{
"name": "[concat(parameters('virtualMachineName'), copyindex(),'_vtep_ifc')]",
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2016-09-01",
"location": "[parameters('location')]",
"copy": {
"name": "nicLoop",
"count": "[parameters('numberOfInstances')]"
},
"dependsOn": [],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"subnet": {
"id": "[variables('subnetRef')]"
},
"privateIPAllocationMethod": "Dynamic"
}
}
],
"networkSecurityGroup": {
"id": "[resourceId(parameters('nsx_inf_sg'), 'Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
}
}
},
{
"name": "[concat(parameters('virtualMachineName'), copyindex())]",
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2017-03-30",
"location": "[parameters('location')]",
"copy": {
"name": "virtualMachineLoop",
"count": "[parameters('numberOfInstances')]"
},
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', concat(parameters('virtualMachineName'), copyindex(),'_vtep_ifc'))]"
],
"properties": {
"osProfile": {
"computerName": "[parameters('virtualMachineName')]",
"adminUsername": "[variables('adminUsername')]",
"adminPassword": "[variables('adminPassword')]",
"windowsConfiguration": {
"provisionVmAgent": "true"
}
},
"hardwareProfile": {
"vmSize": "[parameters('virtualMachineSize')]"
},
"storageProfile": {
"imageReference": {
"id": "[concat('/subscriptions/', parameters('subscription_id'), '/resourceGroups/', parameters('storage_acc_rg'), '/providers/Microsoft.Compute/images/windows-2012-r2-template03282018')]"
},
"osDisk": {
"createOption": "fromImage",
"managedDisk": {
"storageAccountType": "Standard_LRS"
}
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', concat(parameters('virtualMachineName'), copyindex(),'_vtep_ifc'))]"
}
]
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[reference(resourceId(parameters('storage_acc_rg'), 'Microsoft.Storage/storageAccounts', parameters('diagnosticsStorageAccountName')), '2015-06-15').primaryEndpoints['blob']]"
}
}
},
"resources": [
{
"apiVersion": "2015-06-15",
"type": "Microsoft.Compute/virtualMachines/extensions",
"name": "[concat(parameters('virtualMachineName'), copyindex(), '/nsxagent')]",
"location": "[parameters('location')]",
"scale": null,
"dependsOn": [
"[concat(parameters('virtualMachineName'), copyindex())]"
],
"tags": {
"displayName": "nsxagent"
},
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.9",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"[variables('extension_nsx_install')]"
],
"commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -File ', variables('command_to_execute'))]"
}
}
}
]
}
],
"outputs": {
"adminUsername": {
"type": "string",
"value": "[variables('adminUsername')]"
}
}
}
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with test_deploy.py at line 47 and the ARM template's Microsoft.Compute virtualMachines/extensions resource. Review the CustomScriptExtension command and the extension logs alongside the deployment operation details. Done means identifying why the deployment reports VMExtensionProvisioningError despite the script running, then documenting the confirmed cause or required template change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, powershell, python
- Domain
- cloud, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100