Ayaz
Ayaz

Reputation: 1

Configuration of Managed Service Identity(MSI)

2019-10-02T04:00:46.7615707Z ##[error]Error: Failed to get resource ID for resource type 'Microsoft.Web/Sites' and resource name 'morningtonFrontEnd'. Error: Could not fetch access token for Managed Service Principal. Please configure Managed Service Identity (MSI) for virtual machine 'https://aka.ms/azure-msi-docs'. Status code: 400, status message: Bad Request.

Could anyone explain to me what is the issue?

I have "Contributor" access to Azure.

Logs:

2019-10-02T04:00:45.2038473Z ##[section]Starting: Deploy Azure App Service
2019-10-02T04:00:45.2159933Z ==============================================================================
2019-10-02T04:00:45.2160013Z Task         : Azure App Service deploy

2019-10-02T04:00:45.2160056Z 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-10-02T04:00:45.2160116Z Version      : 4.157.1

2019-10-02T04:00:45.2160154Z Author       : Microsoft Corporation

2019-10-02T04:00:45.2160215Z Help         : https://learn.microsoft.com/azure/devops/pipelines/tasks/deploy/azure-rm-web-app-deployment

2019-10-02T04:00:45.2160272Z ==============================================================================
2019-10-02T04:00:46.7125417Z Got service connection details for Azure App Service:'morningtonFrontEnd'

2019-10-02T04:00:46.7615707Z ##[error]Error: Failed to get resource ID for resource type 'Microsoft.Web/Sites' and resource name 'morningtonFrontEnd'. Error: Could not fetch access token for Managed Service Principal. Please configure Managed Service Identity (MSI) for virtual machine 'https://aka.ms/azure-msi-docs'. Status code: 400, status message: Bad Request

2019-10-02T04:00:46.7625812Z (node:2404) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'getApplicationURL' of undefined

2019-10-02T04:00:46.7741572Z Failed to add release annotation. TypeError: Cannot read property 'getApplicationSettings' of undefined

2019-10-02T04:00:46.7782967Z ##[section]Finishing: Deploy Azure App Service

Upvotes: 0

Views: 6912

Answers (1)

Mengdi Liang
Mengdi Liang

Reputation: 19026

[error]Error: Failed to get resource ID for resource type 'Microsoft.Web/Sites' and resource name 'morningtonFrontEnd'. Error: Could not fetch access token for Managed Service Principal. Please configure Managed Service Identity (MSI) for virtual machine 'https://aka.ms/azure-msi-docs'. Status code: 400, status message: Bad Request

Focus on this error message, the next error line UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'getApplicationURL' of undefined caused by the first service connection could not connect successfully.

For this error, it does not relevant your Contributor role. This generally because the authentication token is expired or invalid. You can first click Verify connection to check whether this connection is nothing goes wrong. If the verification is successful, it will show verified, which means that the current connection is no problem.

enter image description here

If this verified failed, you'd better re-create one new service connection. Please follow this doc and this blog to start the create steps.

After the service connection created successfully, click Verify connection firstly. Just ensure nothing goes wrong, then use it in pipeline.

Also, not forget click Authorized in task configuration:

enter image description here

Finish all above pre-verification steps, the error should not appear again.

Upvotes: 2

Related Questions