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: ClientLibraryConsoleAppSample/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Client Libraries Sample
2
2
3
-
The [Client Libraries](https://www.visualstudio.com/en-us/docs/integrate/get-started/client-libraries/dotnet) are .NET libraries made to simplify integration with Visual Studio Team Services and Team Foundation Server (2015 and later). They allow access to both the Traditional Client Object Model and [new REST APIs](https://www.visualstudio.com/en-us/docs/integrate/api/overview).
3
+
For native applications the best way to authenticate and access VSTS resources is using the [Client Libraries](https://www.visualstudio.com/en-us/docs/integrate/get-started/client-libraries/dotnet). They are .NET libraries made to simplify integration with Visual Studio Team Services and Team Foundation Server (2015 and later). They allow access to both the Traditional Client Object Model and [new REST APIs](https://www.visualstudio.com/en-us/docs/integrate/api/overview).
//============= Config [Edit these with your settings] =====================
17
12
internalconststringvstsCollectionUrl="https://myaccount.visualstudio.com";//change to the URL of your VSTS account; NOTE: This must use HTTPS
13
+
internalconststringclientId="872cd9fa-d31f-45e0-9eab-6e460a02d1f1";//update this with your Application ID from step 2.6 (do not change this if you have an MSA backed account)
Copy file name to clipboardExpand all lines: DeviceProfileSample/README.md
+40-6Lines changed: 40 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,22 +6,56 @@ For a headless text output client application, it is not possible authenticate t
6
6
7
7
This buildable sample will walk you through the steps to create a client-side console application which uses ADAL to authenticate a user via the [Device Profile flow](https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-deviceprofile/?v=17.23h) and returns a JSON string containing all account team project data viewable by the authenticated user.
8
8
9
+
To run this sample for an [Azure Active Directory](https://docs.microsoft.com/en-us/azure/active-directory/active-directory-whatis) backed VSTS account you will need:
10
+
*[Visual Studio IDE](https://www.visualstudio.com/vs/)
11
+
* An Azure Active Directory (AAD) tenant. If you do not have one, follow these [steps to set up an AAD](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-howto-tenant)
12
+
* A user account in your AAD tenant
13
+
* A VSTS account backed by your AAD tenant where your user account has access. If you have an existing VSTS account not connected to your AAD tenant follow these [steps to connect your AAD tenant to your VSTS account](https://www.visualstudio.com/en-us/docs/setup-admin/team-services/manage-organization-access-for-your-account-vs)
14
+
15
+
To run this sample for a [Microsoft Account](https://account.microsoft.com/account) backed VSTS account you will need:
16
+
*[Visual Studio IDE](https://www.visualstudio.com/vs/)
17
+
* A VSTS account not connected to AAD
18
+
9
19
## Step 1: Clone or download vsts-auth-samples repository
## Step 2: Register the sample application with you Azure Active Directory tenant (AAD backed VSTS account)
27
+
28
+
```no-highlight
29
+
If you are a Microsoft Account backed VSTS account please skip this step.
30
+
```
31
+
32
+
1. Sign in to the [Azure Portal](https://portal.azure.com).
33
+
2. On the top bar, click on your account and under the Directory list, choose the Active Directory tenant where you wish to register your application.
34
+
3. On the left hand navigation menu, select `Azure Active Directory`.
35
+
4. Click on `App registrations` and select `New application registration` from the top bar.
36
+
5. Enter a `name` for you application, ex. "Adal native app sample", choose `Native` for `application type`, and enter `http://adalsample` for the `Redirect URI`. Finally click `create` at the bottom of the screen.
37
+
6. Save the `Application ID` from your new application registration. You will need it later in this sample.
38
+
7. Grant permissions for VSTS. Click `Required permissions` -> `add` -> `1 Select an API` -> type in and select `Microsoft Visual Studio Team Services` -> check the box for `Delegated Permissions` -> click `Select` -> click `Done` -> click `Grant Permissions` -> click `Yes`.
39
+
40
+
## Step 3: Install and configure ADAL (optional)
17
41
18
42
Package: `Microsoft.Identity.Model.Clients.ActiveDirectory` has already been installed and configured in the sample, but if you are adding to your own project you will need to [install and configure it yourself](https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory).
19
43
20
-
## Step 3: Run the sample
44
+
## Step 4a: Run the sample (AAD backed VSTS account)
45
+
46
+
1. Navigate to the sample in cloned repo `vsts-auth-samples/DeviceProfileSample/`
47
+
2. Open the solution file `DeviceProfileSample.sln` in [Visual Studio 2017](https://www.visualstudio.com/downloads/)
48
+
3. Use [Nuget package restore](https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore) to ensure you have all dependencies installed
49
+
4. Open CS file `Program.cs` and there is a section with input values to change at the top of the class:
50
+
*`vstsCollectionUrl` - Update this value to your VSTS collection URL, e.g. http://myaccount.visualstudio.com.
51
+
*`clientId` - Update this value with the `Application ID` you saved in step 2.6.
52
+
5. Build and run solution. You should see a console window with instructions on how to authenticate via the Device Profile flow. After authenticating you should see all team project information viewable by the authenticated identity displayed in the console window.
53
+
54
+
## Step 4b: Run the sample (Microsoft Account backed VSTS account)
21
55
22
56
1. Navigate to the sample in cloned repo `vsts-auth-samples/DeviceProfileSample/`
23
-
2.Use [Nuget package restore](https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore) to ensure you have all dependencies installed
24
-
3.Open the solution file `DeviceProfileSample.csproj` in [Visual Studio 2017](https://www.visualstudio.com/downloads/)
57
+
2.Open the solution file `DeviceProfileSample.sln` in [Visual Studio 2017](https://www.visualstudio.com/downloads/)
58
+
3.Use [Nuget package restore](https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore) to ensure you have all dependencies installed
25
59
4. Open CS file `Program.cs` and there is a section with input values to change at the top of the class:
26
-
*`vstsCollectionUrl` - Mutable value. This is the url to your VSTS collection, e.g. http://myaccount.visualstudio.com for VSTS.
27
-
5. Build and run solution. You should see a console window with instruction on how to authenticate via the Device Profile flow. After authenticating you should see all team project information viewable by the authenticated identity displayed in the console window.
60
+
*`vstsCollectionUrl` - Update this valueto your VSTS collection URL, e.g. http://myaccount.visualstudio.com.
61
+
5. Build and run solution. You should see a console window with instructions on how to authenticate via the Device Profile flow. After authenticating you should see all team project information viewable by the authenticated identity displayed in the console window.
0 commit comments