Search code examples
authenticationazure-devops-rest-apiunauthorized

Azure DevOps REST API, Authentication not working for build(s), yet for workitems it is


I am trying to get the latest build-logs from azure devops with postman (as an example). I have a accesstoken which I use to get all workitems and this works fine. for example: https://dev.azure.com/{organization}/{project}/_apis/wit/workitemsbatch?api-version=5.1

however, when I do the same for builds

https://dev.azure.com/{organization}/{project}/_apis/build/builds?api-version=5.1

I am getting an 401 Unauthorized.

It's the same token from my App Registration. My permissions is just the one: https://app.vssps.visualstudio.com/user_impersonation

What am I missing here?


Solution

  • If you don't select full access when you create your token make sure either the Read or Read and Execute box under Build permissions is checked when you create the access token. https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page