View deployment history with Azure Resource Manager
Artikkel
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.
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.
The examples in this article show how to retrieve the correlation ID.
Resource group deployments
You can view details about a resource group deployment through the Azure portal, PowerShell, Azure CLI, or REST API.
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.azure.com/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.azure.com/subscriptions/{subscription-id}/resourcegroups/{resource-group-name}/providers/microsoft.resources/deployments/{deployment-name}?api-version={api-version}
az deployment sub show --name ExampleDeployment --query properties.correlationId
To list the deployments for a subscription, use the following operation. For the latest API version number to use in the request, see Deployments - List At Subscription Scope.
GET https://management.azure.com/subscriptions/{subscriptionId}/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 At Subscription Scope.
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}?api-version={api-version}
Select the management group you want to examine. If you don't have sufficient permissions to view details about the management group, you won't be able to select it.
In the left pane, select 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 management group, use the Get-AzManagementGroupDeployment command. If you don't have sufficient permissions to view deployments for the management group, you'll get an error.
To list all the deployments for a management group, use az deployment mg list. If you don't have sufficient permissions to view deployments for the management group, you'll get an error.
az deployment mg list --management-group-id examplemg
az deployment mg show --management-group-id examplemg --name ExampleDeployment
To get the correlation ID, use:
az deployment mg show --management-group-id examplemg --name ExampleDeployment --query properties.correlationId
To list the deployments for a management group, use the following operation. For the latest API version number to use in the request, see Deployments - List At Management Group Scope. If you don't have sufficient permissions to view deployments for the management group, you'll get an error.
GET https://management.azure.com/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/?api-version={api-version}
GET https://management.azure.com/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}?api-version={api-version}
The portal doesn't currently show tenant deployments.
To list all deployments for the current tenant, use the Get-AzTenantDeployment command. If you don't have sufficient permissions to view deployments for the tenant, you'll get an error.
Get-AzTenantDeployment
To get a specific deployment from the current tenant, add the Name parameter.
To list all the deployments for the current tenant, use az deployment tenant list. If you don't have sufficient permissions to view deployments for the tenant, you'll get an error.
az deployment tenant show --name ExampleDeployment
To get the correlation ID, use:
az deployment tenant show --name ExampleDeployment --query properties.correlationId
To list the deployments for the current tenant, use the following operation. For the latest API version number to use in the request, see Deployments - List At Tenant Scope. If you don't have sufficient permissions to view deployments for the tenant, you'll get an error.
GET https://management.azure.com/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 At Tenant Scope.
GET https://management.azure.com/providers/Microsoft.Resources/deployments/{deploymentName}?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 view deployment operations for other scopes, use:
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.azure.com/subscriptions/{subscription-id}/resourcegroups/{resource-group-name}/providers/microsoft.resources/deployments/{deployment-name}/operations?$skiptoken={skiptoken}&api-version={api-version}