通过 Azure 资源管理器,你能够查看部署历史记录。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.
一个资源组的部署历史记录限含 800 个部署。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.
可通过 Azure 门户、PowerShell、Azure CLI 或 REST API 查看部署详细信息。You can view details about a deployment through the Azure portal, PowerShell, Azure CLI, or REST API.每个部署都有一个相关 ID,用于跟踪相关的事件。Each deployment has a correlation ID, which is used to track related events.如果你创建 Azure 支持请求,则客户支持可能会要求你提供相关 ID。If you create an Azure support request, support may ask you for the correlation ID.客户支持使用相关 ID 来识别失败部署的操作。Support uses the correlation ID to identify the operations for the failed deployment.
az deployment group show --resource-group ExampleGroup --name ExampleDeployment
若要获取相关 ID,请使用: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.如需在请求中使用的最新 API 版本号,请参阅部署 - 按资源组列出。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.如需在请求中使用的最新 API 版本号,请参阅部署 - 获取。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}
响应包含相关 ID。The response includes the correlation ID.
获取部署操作和错误消息Get 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.
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 ExampleDeploy --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 ExampleDeploy --query "[?properties.provisioningState=='Failed'].properties.statusMessage.error"
若要获取部署操作,请使用以下操作。To get deployment operations, use the following operation.如需在请求中使用的最新 API 版本号,请参阅部署操作 - 列出。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}