0
votes

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://docs.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
1
Could you include more details in your question?Joy Wang-MSFT
I have attached the logs. Please find and do let me know if you need some more information.Ayaz
What about click Verify connection? Go service connection, and click the button. Ensure it verified successfully. imgur.com/a/jHmRUSBMerlin Liang - MSFT
Hi, how’s the things going now? Does the below solution an help you solve the issue? If yes, you can accept this answer. Don’t hesitate to leave comment here if you still has any puzzle, thus we could still help you.Merlin Liang - MSFT

1 Answers

2
votes

[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.