Skip to content

Latest commit

 

History

History
39 lines (25 loc) · 1.84 KB

File metadata and controls

39 lines (25 loc) · 1.84 KB

Non-interactive PAT generation sample

This sample shows how to generate a Personal Access Token (PAT) using the Client Libraries and the PAT Lifecycle Management API. Requests to this API need to be authorized with an Azure Active Directory (AAD) access token.

This sample uses the PublicClientApplicationBuilder from Microsoft Authentication Library (MSAL) rather than relying on the interactive pop-up dialog to get an AAD access token which is then used as a credential to authenticate requests to Azure DevOps. This is meant to be used in scenarios where you need to generate a PAT associated with an account that does not have interactive login rights.

How to run this sample

Prerequisites

Step 1: Clone or download this repository

From a shell or command line:

git clone https://github.com/microsoft/azure-devops-auth-samples.git

Step 2: Configure the sample to use your Azure AD application

Update the configuration file App.config with the information about your AAD application, AAD credentials, and Azure DevOps organization.

Step 3: Run the sample

From Visual Studio:

  1. Open the solution file NonInteractivePatGenerationSample.sln.
  2. Build and run the project.

-- OR --

From the command line:

cd NonInteractivePatGenerationSample/NonInteractivePatGenerationSample
dotnet run