Arm 模板验证通过 Azure Devops 版本失败,从 powershell 和 test-AzResourceGroupDeployment 工作

Arm template validation fails through Azure Devops release, works from powershell and test-AzResourceGroupDeployment

我有一个发布设置,正在尝试通过 Azure Devops 发布管道发布。这是基于我克隆的另一个版本并且工作正常。

问题是模板未通过验证检查,无法继续。奇怪的是我能够使用 new-AzResourceGroupDeployment 和 test-AzResourceGroupDeployment 成功检查语法。它没有报告任何错误,并且一直在正常部署。

使用 Azure Devops 发布返回的错误是:

2020-02-26T12:26:16.2632844Z ==============================================================================
2020-02-26T12:26:16.2633634Z Task         : ARM template deployment
2020-02-26T12:26:16.2634204Z Description  : Deploy an Azure Resource Manager (ARM) template to all the deployment scopes
2020-02-26T12:26:16.2634534Z Version      : 3.1.19
2020-02-26T12:26:16.2634945Z Author       : Microsoft Corporation
2020-02-26T12:26:16.2635504Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-resource-group-deployment
2020-02-26T12:26:16.2635948Z ==============================================================================
2020-02-26T12:26:16.8677026Z ARM Service Conection deployment scope - Subscription
2020-02-26T12:26:16.8760315Z Checking if the following resource group exists: myResourceGroup.
2020-02-26T12:26:17.2234188Z Resource group exists: true.
2020-02-26T12:26:17.2259290Z Creating deployment parameters.
2020-02-26T12:26:17.2558066Z The detected encoding for file 'd:\a\r1\a\_Azure-Infrastructure\myResourceGroup\deployment\azuredeploy.json' is 'utf-8'
2020-02-26T12:26:17.2561303Z The detected encoding for file 'd:\a\r1\a\_Azure-Infrastructure\myResourceGroup\deployment\param.dev.json' is 'utf-8'
2020-02-26T12:26:17.5304032Z Starting template validation.
2020-02-26T12:26:17.5304834Z Deployment name is Release-vstfs:///ReleaseManagement/Release/95
2020-02-26T12:26:17.5877973Z ##[warning]Validation errors were found in the Azure Resource Manager template. This can potentially cause template deployment to fail. Template validation failed. Error: {"message":"No HTTP resource was found that matches the request URI 'https://management.azure.com/subscriptions/mySubscription/resourcegroups/myResourceGroup/providers/Microsoft.Resources/deployments/Release-vstfs:/ReleaseManagement/Release/95/validate?api-version=2017-05-10'."}.. Please follow https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-syntax
2020-02-26T12:26:17.5890527Z Starting Deployment.
2020-02-26T12:26:17.5891348Z Deployment name is Release-vstfs:///ReleaseManagement/Release/95
2020-02-26T12:26:17.6289831Z There were errors in your deployment. Error code: undefined.
2020-02-26T12:26:17.6291819Z ##[error][object Object]
2020-02-26T12:26:17.6295387Z ##[error]Task failed while creating or updating the template deployment.
2020-02-26T12:26:17.6399260Z ##[section]Finishing: ARM Template deployment: Resource Group scope

查看上面的日志,我不确定它是否因验证错误而失败,或者在接近尾声时出现未定义错误代码的错误。

任务来自另一个订阅,它列在任务的 Azure 资源管理器连接中,还列出了订阅和订阅中的资源组。

有人对我如何使它正常工作或从哪里开始进行故障排除有任何想法吗?

您的部署名称是:

Release-vstfs:/ReleaseManagement/Release/95

相当确定这是不允许的 (/)。因此您需要将部署名称设置为合理的名称。

ps。 : 也可能不允许

您是否看过 Activity 登录 Azure portal

所有部署尝试都记录在此处。请特别注意 JSON 窗格,通常真正的问题只显示在这里。

否则,如果它没有到达 Azure,您能否仔细检查 Azure DevOps 中的服务连接? (特别是 Azure 中的相关用户权限)