Why am I getting CouldnotfetchacccesstokenforAzureStatusCode when releasing to Azure from TFS

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:

  • It binds the service connection to your Azure AD (Tenant ID)
  • It creates an application in the azure AD and uses the ClientID in the release process
  • It binds the service connection to your subscription ID
  • It creates a Principal key (like a password) which can last 1 or 2 years. It was this value that was missing in my original service. You can create your own Principal keys or have TFS autocreate one for you.

Thanks for the hint Juunas!


I didn't have to recreate the service connection. I just had to update it and that made the release work again.

  1. Open the project in Azure DevOps
  2. Click on the pencil to the right of the project name in the overview page, to go to project settings
  3. Click on Service Connections under Pipelines
  4. Choose azure service connection
  5. Click on Update service connection

Azure DevOps screenshot