You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: NonInteractivePatGenerationSample/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
1
# Non-interactive PAT generation Sample
2
2
3
-
This sample shows how to generate a Personal Access Token (PAT) using the [Client Libraries](https://www.visualstudio.com/en-us/docs/integrate/get-started/client-libraries/dotnet). You cannot use a PAT to generate a PAT and so this sample makes use of the Azure Active Directory Authentication Library (ADAL) to acquire an AAD token which is then used as a credential to authenticate requests to VSTS. This sample also uses the UserPasswordCredential rather than relying on the interactive pop-up dialog - this can be useful in scenarios where you need to generate a PAT associated with an account that does not have interactive login rights.
3
+
This sample shows how to generate a Personal Access Token (PAT) using the [Client Libraries](https://docs.microsoft.com/en-us/azure/devops/integrate/concepts/dotnet-client-libraries?view=vsts). You cannot use a PAT to generate a PAT and so this sample makes use of the Azure Active Directory Authentication Library (ADAL) to acquire an AAD token which is then used as a credential to authenticate requests to Azure DevOps. This sample also uses the UserPasswordCredential rather than relying on the interactive pop-up dialog - this can be useful in scenarios where you need to generate a PAT associated with an account that does not have interactive login rights.
4
4
5
5
## Sample Application
6
6
7
-
This sample shows the basic flow for calling ADAL, and then using the resulting token as credentials to call the ```CreateSessionToken``` method on the ```DelegatedAuthorizationHttpClient``` class. In order to run this application you will need to [register your own AAD application](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-integrating-applications).
7
+
This sample shows the basic flow for calling ADAL, and then using the resulting token as credentials to call the ```CreateSessionToken``` method on the ```DelegatedAuthorizationHttpClient``` class. In order to run this application you will need to [register your own AAD application](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-v1-integrate-apps-with-azure-ad).
8
8
9
9
## Step 1: Clone or download vsts-auth-samples repository
1. Navigate to the sample in cloned repo `vsts-auth-samples/NonInteractivePatGenerationSample/`
19
19
2. Use [Nuget package restore](https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore) to ensure you have all dependencies installed
20
20
3. Open the solution file `NonInteractivePatGenerationSample.sln` in [Visual Studio 2017](https://www.visualstudio.com/downloads/)
21
-
4. Open CS file ```Program.cs``` and look at the first few lines in the ```Main``` method. Replace the username and password with the appropriate values. You will need to get the ```aadApplicationID``` value by [registering your app in AAD](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-integrating-applications).
22
-
6. Build and run the solution, the generate PAT will be output to the console window.
21
+
4. Open CS file ```Program.cs``` and look at the first few lines in the ```Main``` method. Replace the username and password with the appropriate values. You will need to get the ```aadApplicationID``` value by [registering your app in AAD](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-v1-integrate-apps-with-azure-ad).
22
+
6. Build and run the solution, the generate PAT will be output to the console window.
0 commit comments