Tags:

Error: Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired!

I was doing a quick deploy to my Azure-hosted Optimizely CMS 12 website, using Azure DevOps Pipelines, for the 237th time when this error popped up.

Error: Failed to get resource ID for resource type 'Microsoft.Web/Sites' and resource name 'gulla'. Error: Could not fetch access token for Azure. Verify if the Service Principal used is valid and not expired. For more information refer https://aka.ms/azureappservicedeploytsg

For me, it was not obvious how to fix this problem, but the solution is found at docs.microsoft.com.

  1. Go to Project settings > Service connections, and then select the service connection you want to modify.

  2. Select Edit in the upper-right corner, and then select Verify.

  3. Select Save.

 

That's it!