'Generate Azure Devops PAT without interactive prompt (API)
I'd like to rotate PATs rather frequently and have them be dynamically fetched by an application.
In order to properly rotate PATs, I'd like to use the PAT endpoint:
https://vssps.dev.azure.com/<your_org>/_apis/tokens/pats?api-version=7.1-preview.1
I understand I'll need an Azure AD Token in order to achieve this, I've gotten one but my script or API calls keep getting 203'd and I get an HTML response.
I've registered an Application (App Registration) in my Azure AD and am using the ConfidentialClientApp to generate an AD Token using MSAL in python as such:
app = ConfidentialClientApplication(
client_id=<id>,
client_credential=<token>,
authority="https://login.microsoftonline.com/<your_org>")
token = app.acquire_token_for_client(scopes=["499b84ac-1321-427f-aa17-267ca6975798/.default"])
This token however, is not getting me anywhere, again I'm hitting 203's.
Is this due to me trying a non-interactive way to generate my AD Tokens? There's no way I could do this interactively, that would beat the purpose. The App Registration, by the way, has the correct permissions setup on ADO.
Any ideas?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
