1

I was trying to create an Azure DevOps pipeline with the help of REST API. But I know that the authentication can be established with the help of a token. But anybody knows how to authenticate Azure DevOps with the help of the service principle for REST API? Any documents? I tried to figure out the answer from Microsoft documents and the internet but didn't find anything useful.

Thanks

Sridevi
  • 10,599
  • 1
  • 4
  • 17
Techiescorner
  • 791
  • 2
  • 12
  • 25

1 Answers1

0

I tried to reproduce the same in my environment and got the results successfully like below:

To authenticate Azure DevOps with the help of the service principle, I created an Azure AD Application and granted the Azure DevOps API permission:

enter image description here

I used the below parameters and generated the code value:

GET
https://login.microsoftonline.com/TenantId/oauth2/v2.0/authorize?  
  
&client_id=ClientID
&scope=499b84ac-1321-427f-aa17-267ca6975798/user_impersonation
&response_type=code
&redirect_uri=https://jwt.ms
&response_mode=query
&state=12345

enter image description here

I generated the access token successfully like below:

GET
https://login.microsoftonline.com/TenantID/oauth2/v2.0/token

client_id:client_id
grant_type:authorization_code
code:code
redirect_uri:redirect_uri
scope:499b84ac-1321-427f-aa17-267ca6975798/user_impersonation
client_secret:client_secret

enter image description here

I am able to successfully authenticate Azure DevOps by using access token like below:

enter image description here

Rukmini
  • 6,015
  • 2
  • 4
  • 14