Reputation: 301
I wonder if I am the only one getting this CouldnotfetchacccesstokenforAzureStatusCode when deploying(release workflow) from TFS (visualstudio.com) to Azure. Even google doesnt have a clue.
The release workflow profile was set up from within Azure, so I guess the Subscription and Service name are ok. Afterall it manages to get the artifacts transfered. And it HAS been working for a week before it stopped working. It is triggered by a successfull hosted build after a git push. No manual work.
##[section]Finishing: Download Artifacts
##[section]Starting: Deploy Azure App Service
==============================================================================
Task : Azure App Service Deploy
Description : Update Azure App Service using Web Deploy / Kudu REST APIs
Version : 2.1.10
Author : Microsoft Corporation
Help : [More Information](https://aka.ms/azurermwebdeployreadme)
==============================================================================
d19c95a6-ebscrabbeldabbeld9c3eb0cfeb exists true
##[warning]Can\'t find loc string for key: CouldnotfetchacccesstokenforAzureStatusCode
##[error]CouldnotfetchacccesstokenforAzureStatusCode 400 Bad Request
##[section]Finishing: Deploy Azure App Service
##[section]Finishing: Release
I have "Publish using Web Deploy" and "Take App Offline" and the Control Opption "Enabled" checked. The App Service is version 2. Any ideas?
EDIT: Tried version 3(in preview) and I got a different (but probably the same) error:
##[error]Could not fetch acccess token for Azure. Status Code: 400 (Bad Request)
Upvotes: 9
Views: 5405
Reputation: 2424
I didn't have to recreate the service connection. I just had to update it and that made the release work again.
Upvotes: 10
Reputation: 11
Just solved this issue by unlinking all the linked items on the deploy step. So 'Azure Subscription' and 'App Service name', even though they appeared to be set correctly... this got it working for me.
Upvotes: 1
Reputation: 538
Another possible cause for this error -
I have seen this problem occur using the new "Build Editor" (still in preview).
TL;DR The solution would be to NOT use the "process linked parameters" feature for the subscription related parameters until the bug described below is solved.
In that case, if the "process linked parameters" feature is used and the subscription to be used is specified on the "process" level the following would happen:
ENDPOINT_AUTH_*
of the process level pointing at the wrong "id" for the service endpoint. Unclear why that happens - I tend to blame the initial job message from VSTS following the code here for the agent.Setting the "debug" flag to 'true' during enqueue of the build would reveal the above in the traces.
Upvotes: 0
Reputation: 301
I recreated the service connection as juunas mentioned, and that worked. You will find it under "Services" in TFS. So whats the magic bedhind it:
Thanks for the hint Juunas!
Upvotes: 11