0

I've set up some on-prem Docker-based DevOps agents using a Docker Swarm. However, these agents rely on a PAT to authenticate and connect with our on-prem DevOps 2019 - not a HUGE issue, but PATs have a max lifetime of a year, and I'd rather have this system working longer if possible (on-prem solutions tend to have a lifetime of their own after all).

I know DevOps has an API - alas attempting to find information on how to use it directs me to the DevOps Services (online) versions, which aren't going to work for me (they use things like AAD applications for authentication and that's clearly not going to work on-prem). Annoyingly trying to change the documentation to show what's valid for DevOps 2019 redirects back to documentation for DevOps Services.

Any idea how to generate a PAT using the API on an on-prem DevOps instance, preferably by authenticating via username + password? Or at least where can I find some documentation on this?

MBender
  • 5,395
  • 1
  • 42
  • 69

1 Answers1

-1

If you are trying to use PAT REST API, then you can find it in Azure documents which i am sharing here: https://learn.microsoft.com/en-us/azure/devops/organizations/accounts/manage-personal-access-tokens-via-api?view=azure-devops

Hope this will help you out.

  • The linked documentation is for DevOps Services aka DevOps online. First part of described authentication has to do with AAD which I'm 99% sure won't work with a DevOps 2019 on-prem instance. – MBender Oct 31 '22 at 07:59
  • @MBender were you able to find a solution? I am facing the same issue. Thanks! – user18610347 Feb 10 '23 at 20:04
  • @user18610347 **I haven't yet tested this, so this is just an idea at this point!** I've been using the `Microsoft.TeamFoundationServer.Client` package to do some custom statistic calculations on our GIT repos and I see there's something called a `TokensHttpClient` in there as well. It MAY work with an on-prem DevOps Server (see [this question](https://stackoverflow.com/questions/69300825/creating-an-azure-devops-personal-access-token-pat-using-c-sharp) - this fails for the author as they are using DevOps Online; it **MAY** work for on-prem). – MBender Feb 12 '23 at 12:30
  • @user18610347 Nope, scratch my previous comment. This doesn't work, as it seems the Nuget package is still using the same APIs that would normally be available in DevOps Online -> it cannot be used with DevOps on-prem. :( – MBender Feb 13 '23 at 14:39