View deployment history with Azure Resource Manager
Article
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.
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.
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}
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.
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}