question

PrathyushaSadhuMINDTREELIMITED-0133 avatar image
1 Vote"
PrathyushaSadhuMINDTREELIMITED-0133 asked TomPitts-7306 commented

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

When we are deploying the web app we are facing this issue:

Error: Failed to get resource ID for resource type 'Microsoft.Web/Sites' and resource name 'DPSREQUESTFORMS'. 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

azure-webapps
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Just checking in to see if the below answers helped. If this answers your query, do click “Accept Answer” and Up-Vote for the same. And, if you have any further query do let us know.

0 Votes 0 ·
SnehaAgrawal-MSFT avatar image
2 Votes"
SnehaAgrawal-MSFT answered

Thanks for asking question! To elaborate on this you may want to know that Azure App Service Deploy task uses the service principal in the service connection to authenticate with Azure. The task fails with this error if the service principal has expired or doesn't have permissions to the App Service.

Recommend you to verify the validity of the service principal used and if it's present in the app registration.

You may refer to Use role-based access control to manage access to your Azure subscription resources and SO link here

Also check this blog on Automating Azure Resource Group deployment using a Service Principal in Visual Studio Online: Build/Release Management

Let us know if further query on this or issue remains.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

VenuKotte-4082 avatar image
5 Votes"
VenuKotte-4082 answered TomPitts-7306 commented

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

if you are facing this issue , you can navigate to

Azure Devops _> ProjectSettings ------> PipeLines --------> Service Connections --------->

here you can find the list of service connections available were displayed . select the service connection which you are facing issue

175882-image.png


you will find this screen

175789-image.png


it will navigate to expired page

175809-image.png




then you can observe expired token one , delete that and create a new certificate .


final step is you need to go to back like


Azure Devops _> ProjectSettings ------> PipeLines --------> Service Connections --------->


select the service connection which you are facing issue ---> select the edit button ---and just click on save button _---------> it will asks azure authentication ------> once you are done with
successful authentication , release pipe line works like as usual ,.


image.png (13.5 KiB)
image.png (16.4 KiB)
image.png (156.6 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thank you kindly Venu - this was very helpful

0 Votes 0 ·