Azure Resource Manager enables you to view your deployment history. You can examine specific operations in past deployments and see which resources were deployed. This history contains information about any errors.
The deployment history for a resource group is limited to 800 deployments. As you near the limit, deployments are automatically deleted from the history. For more information, see Automatic deletions from deployment history.
For help with resolving particular deployment errors, see Troubleshoot common Azure deployment errors.
Get deployments and correlation ID
You can view details about a deployment through the Azure portal, PowerShell, Azure CLI, or REST API. Each deployment has a correlation ID, which is used to track related events. If you create an Azure support request, support may ask you for the correlation ID. Support uses the correlation ID to identify the operations for the failed deployment.
Select the resource group you want to examine.
Select the link under Deployments.
Select one of the deployments from the deployment history.
A summary of the deployment is displayed, including the correlation ID.
To list all deployments for a resource group, use the Get-AzResourceGroupDeployment command.
Get-AzResourceGroupDeployment -ResourceGroupName ExampleGroup
To get a specific deployment from a resource group, add the DeploymentName
parameter.
Get-AzResourceGroupDeployment -ResourceGroupName ExampleGroup -DeploymentName ExampleDeployment
To get the correlation ID, use:
(Get-AzResourceGroupDeployment -ResourceGroupName ExampleGroup -DeploymentName ExampleDeployment).CorrelationId
To list all the deployments for a resource group, use az deployment group list.
az deployment group list --resource-group ExampleGroup
To get a specific deployment, use the az deployment group show.
az deployment group show --resource-group ExampleGroup --name ExampleDeployment
To get the correlation ID, use:
az deployment group show --resource-group ExampleGroup --name ExampleDeployment --query properties.correlationId
To list the deployments for a resource group, use the following operation. For the latest API version number to use in the request, see Deployments - List By Resource Group.
GET https://management.chinacloudapi.cn/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/?api-version={api-version}
To get a specific deployment, use the following operation. For the latest API version number to use in the request, see Deployments - Get.
GET https://management.chinacloudapi.cn/subscriptions/{subscription-id}/resourcegroups/{resource-group-name}/providers/microsoft.resources/deployments/{deployment-name}?api-version={api-version}
The response includes the correlation ID.
{
...
"properties": {
"mode": "Incremental",
"provisioningState": "Failed",
"timestamp": "2019-11-26T14:18:36.4518358Z",
"duration": "PT26.2091817S",
"correlationId": "aaaa0000-bb11-2222-33cc-444444dddddd",
...
}
}
Deployment operations and error message
Each deployment can include multiple operations. To see more details about a deployment, view the deployment operations. When a deployment fails, the deployment operations include an error message.
On the summary for a deployment, select Operation details.
You see the details for that step of the deployment. When an error occurs, the details include the error message.
To view the deployment operations for deployment to a resource group, use the Get-AzResourceGroupDeploymentOperation command.
Get-AzResourceGroupDeploymentOperation -ResourceGroupName ExampleGroup -DeploymentName ExampleDeployment
To view failed operations, filter operations with Failed state.
Get-AzResourceGroupDeploymentOperation -ResourceGroupName ExampleGroup -Name ExampleDeployment | Where-Object { $_.ProvisioningState -eq "Failed" }
To get the status message of failed operations, use the following command:
(Get-AzResourceGroupDeploymentOperation -ResourceGroupName ExampleGroup -Name ExampleDeployment | Where-Object { $_.ProvisioningState -eq "Failed" }).StatusMessage
To view the deployment operations for deployment to a resource group, use the az deployment operation group list command. You must have Azure CLI 2.6.0 or later.
az deployment operation group list --resource-group ExampleGroup --name ExampleDeployment
To view failed operations, filter operations with Failed state.
az deployment operation group list --resource-group ExampleGroup --name ExampleDeployment --query "[?properties.provisioningState=='Failed']"
To get the status message of failed operations, use the following command:
az deployment operation group list --resource-group ExampleGroup --name ExampleDeployment --query "[?properties.provisioningState=='Failed'].properties.statusMessage.error"
To get deployment operations, use the following operation. For the latest API version number to use in the request, see Deployment Operations - List.
GET https://management.chinacloudapi.cn/subscriptions/{subscription-id}/resourcegroups/{resource-group-name}/providers/microsoft.resources/deployments/{deployment-name}/operations?$skiptoken={skiptoken}&api-version={api-version}
The response includes an error message.
{
"value": [
{
"id": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/examplegroup/providers/Microsoft.Resources/deployments/exampledeployment/operations/1234567890ABCDEF",
"operationId": "1234567890ABCDEF",
"properties": {
"provisioningOperation": "Create",
"provisioningState": "Failed",
"timestamp": "2019-11-26T14:18:36.3177613Z",
"duration": "PT21.0580179S",
"trackingId": "aaaa0000-bb11-2222-33cc-444444dddddd",
"serviceRequestId": "aaaa0000-bb11-2222-33cc-444444dddddd",
"statusCode": "BadRequest",
"statusMessage": {
"error": {
"code": "InvalidAccountType",
"message": "The AccountType Standard_LRS1 is invalid. For more information, see - https://aka.ms/storageaccountskus"
}
},
"targetResource": {
"id": "/subscriptions/aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e/resourceGroups/examplegroup/providers/Microsoft.Storage/storageAccounts/storage",
"resourceType": "Microsoft.Storage/storageAccounts",
"resourceName": "storage"
}
}
},
...
]
}