Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Error: Could not fetch access token for Azure when deploying using Azure DEVOPS

I am trying to deploy a APP using Azure DEVOPS CI/CD Pipelines, however I am receiving the following error:

2022-01-19T19:55:37.5454688Z ##[error]Error: Failed to fetch App Service 'xxxxx' publishing credentials. 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

I checked the Client Secret and they are expired. I asked to the admin create a new one, however still receiving the same error when deploying.

Anyone have an idea? Can be because we still have these two expired keys? Do I have to change something in appsettings? (I do not think so right?)

se

like image 479
Fernando Feks Avatar asked Feb 17 '26 22:02

Fernando Feks


1 Answers

When getting this error on my build pipeline, I was able to follow the steps in this answer (copied below) to solve it. The only other thing I had to do was select a 'Resource group' before hitting Verify in step 5.

  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 make any change to your service connection. The easiest and recommended change is to add a description.

  3. Select Save to save the service connection. Don't try to verify the service connection at this step.

  4. Exit the service connection edit window, and then refresh the service connections page.

  5. Select Edit in the upper-right corner, and now select Verify. (You may need to select a valid Resource group first if one isn't already selected.)

  6. Select Save to save your service connection.

like image 85
Craig Brown Avatar answered Feb 20 '26 10:02

Craig Brown



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!