azureazure-devopstfsazure-pipelinesazure-ad-msal

Azure DevOps API Authentication


I would like to use the Azure DevOps API to create a PAT for my user. But I'm unable to authenticate yet. In this document from Microsoft, they state that authentication is possible with a PAT, but it is not true. I'm getting a HTTP 203 with a Sign In page in response.

PS: I'm using Postman to test the API requests.


Solution

  • I think the security section of this REST API is misleading.

    In fact, this REST API cannot be authenticated with PAT, as mentioned in another document:

    To use the API, you must authenticate with an Azure AD token.

    Unlike other Azure DevOps Services APIs, users must provide an Azure AD access token to use this API instead of a PAT token. Azure AD tokens are a safer authentication mechanism than using PATs. Given this API’s ability to create and revoke PATs, we want to ensure that such powerful functionality is given to allowed users only.

    This document also explains how to use this REST API in detail, which you can refer to.