Azure 应用服务部署无法获取资源类型“Microsoft.Web/Sites"的资源 ID [英] Azure App Service deploy Failed to get resource ID for resource type 'Microsoft.Web/Sites'
问题描述
在过去的 6 个月中,我一直在使用 Azure DevOps 中的管道进行发布,但今天我收到以下错误:
In the last 6 months I have been releasing with a pipeline in Azure DevOps, but today I receive the following error:
2019-09-25T14:24:38.4296875Z ##[section]Starting: Azure App Service Deploy: AS-ServiciosNegocio-API-UAT
2019-09-25T14:24:38.4419797Z ==============================================================================
2019-09-25T14:24:38.4419900Z Task : Azure App Service deploy
2019-09-25T14:24:38.4419986Z Description : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
2019-09-25T14:24:38.4420053Z Version : 3.4.31
2019-09-25T14:24:38.4420117Z Author : Microsoft Corporation
2019-09-25T14:24:38.4420182Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-rm-web-app-deployment
2019-09-25T14:24:38.4420291Z ==============================================================================
2019-09-25T14:24:39.1630446Z Got connection details for Azure App Service:'AS-ServiciosNegocio-API-UAT'
2019-09-25T14:24:39.3091141Z ##[error]Error: Failed to get resource ID for resource type 'Microsoft.Web/Sites' and resource name 'AS-ServiciosNegocio-API-UAT'. Error: Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired.
2019-09-25T14:24:39.3140156Z ##[section]Finishing: Azure App Service Deploy: AS-ServiciosNegocio-API-UAT
推荐答案
如果您现有的服务连接是Azure Resource Manager using service principal(自动)";类型(非手动),有一种简单但不明显的方法来更新令牌.
If your existing service connection is the "Azure Resource Manager using service principal (automatic)" type (not manual), there's a simple but non-obvious way to renew the token.
如其他答案中所述,转到 Azure Devops 中的服务连接设置页面.点击编辑,然后点击保存,不做任何其他更改.假设你有正确的权限,它会自动获得一个新的令牌.
Go to the service connection's settings page in Azure Devops as described in the other answers. Click Edit and then Save without making any other changes. Assuming you have the right permissions, it will automatically get a new token.
(从 此论坛评论 中发现这一点.)
(Figured this out from this forum comment.)
这篇关于Azure 应用服务部署无法获取资源类型“Microsoft.Web/Sites"的资源 ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!