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: 1. Desktop app calls Web API/AppCreationScripts/AppCreationScripts.md
+24-4Lines changed: 24 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Registering the sample apps with Microsoft Identity Platform and updating the configuration files using PowerShell scripts
1
+
# Registering the sample apps with Microsoft identity platform and updating the configuration files using PowerShell scripts
2
2
3
3
## Overview
4
4
@@ -11,7 +11,8 @@
11
11
```
12
12
1. Run the script to create your Azure AD application and configure the code of the sample application accordingly. (Other ways of running the scripts are described below)
13
13
```PowerShell
14
-
.\AppCreationScripts\Configure.ps1
14
+
cd .\AppCreationScripts\
15
+
.\Configure.ps1
15
16
```
16
17
1. Open the Visual Studio solution and click start
17
18
@@ -26,6 +27,7 @@ The following paragraphs:
26
27
-[Passing credentials](#option-2-non-interactive) to create the app in your home tenant
27
28
-[Interactively in a specific tenant](#option-3-interactive-but-create-apps-in-a-specified-tenant)
28
29
-[Passing credentials in a specific tenant](#option-4-non-interactive-and-create-apps-in-a-specified-tenant)
30
+
-[Passing environment name, for Sovereign clouds](#running-the-script-on-azure-sovereign-clouds)
29
31
30
32
## Goal of the scripts
31
33
@@ -49,7 +51,7 @@ These scripts are:
49
51
50
52
The `Configure.ps1` will stop if it tries to create an Azure AD application which already exists in the tenant. For this, if you are using the script to try/test the sample, or in DevOps scenarios, you might want to run `Cleanup.ps1` just before `Configure.ps1`. This is what is shown in the steps below.
51
53
52
-
## How to use the app creation scripts?
54
+
## How to use the app creation scripts?
53
55
54
56
### Pre-requisites
55
57
@@ -107,7 +109,7 @@ Note that the script will choose the tenant in which to create the applications,
107
109
108
110
#### Option 2 (non-interactive)
109
111
110
-
When you know the indentity and credentials of the user in the name of whom you want to create the applications, you can use the non-interactive approach. It's more adapted to DevOps. Here is an example of script you'd want to run in a PowerShell Window
112
+
When you know the identity and credentials of the user in the name of whom you want to create the applications, you can use the non-interactive approach. It's more adapted to DevOps. Here is an example of script you'd want to run in a PowerShell Window
All the four options listed above, can be used on any Azure Sovereign clouds. By default, the script targets `AzureCloud`, but it can be changed using the parameter `-AzureEnvironmentName`.
Copy file name to clipboardExpand all lines: 1. Desktop app calls Web API/AppCreationScripts/Cleanup.ps1
+18-8Lines changed: 18 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,14 @@
2
2
param(
3
3
[PSCredential] $Credential,
4
4
[Parameter(Mandatory=$False,HelpMessage='Tenant ID (This is a GUID which represents the "Directory ID" of the AzureAD tenant into which you want to create the apps')]
5
-
[string] $tenantId
5
+
[string] $tenantId,
6
+
[Parameter(Mandatory=$False,HelpMessage='Azure environment to use while running the script (it defaults to AzureCloud)')]
7
+
[string] $azureEnvironmentName
6
8
)
7
9
10
+
#Requires -ModulesAzureAD
11
+
12
+
8
13
if ($null-eq (Get-Module-ListAvailable -Name "AzureAD")) {
Copy file name to clipboardExpand all lines: 1. Desktop app calls Web API/AppCreationScripts/Configure.ps1
+19-8Lines changed: 19 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,13 @@
2
2
param(
3
3
[PSCredential] $Credential,
4
4
[Parameter(Mandatory=$False,HelpMessage='Tenant ID (This is a GUID which represents the "Directory ID" of the AzureAD tenant into which you want to create the apps')]
5
-
[string] $tenantId
5
+
[string] $tenantId,
6
+
[Parameter(Mandatory=$False,HelpMessage='Azure environment to use while running the script (it defaults to AzureCloud)')]
7
+
[string] $azureEnvironmentName
6
8
)
7
9
10
+
#Requires -ModulesAzureAD
11
+
8
12
<#
9
13
This script creates the Azure AD applications needed for this sample and updates the configuration files
10
14
for the visual Studio projects from the data in the Azure AD applications.
@@ -175,6 +179,11 @@ Function ConfigureApplications
175
179
so that they are consistent with the Applications parameters
176
180
#>
177
181
$commonendpoint="common"
182
+
183
+
if (!$azureEnvironmentName)
184
+
{
185
+
$azureEnvironmentName="AzureCloud"
186
+
}
178
187
179
188
# $tenantId is the Active Directory Tenant. This is a GUID which represents the "Directory ID" of the AzureAD tenant
180
189
# into which you want to create the apps. Look it up in the Azure portal in the "Properties" of the Azure AD.
@@ -183,17 +192,17 @@ Function ConfigureApplications
183
192
# you'll need to sign-in with creds enabling your to create apps in the tenant)
Copy file name to clipboardExpand all lines: 1. Desktop app calls Web API/README-incremental.md
+17-22Lines changed: 17 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,19 +16,16 @@ endpoint: Microsoft identity platform
16
16
### Table of content
17
17
18
18
-[About this sample](#about-this-sample)
19
-
-[Scenario](#scenario)
20
-
-[Overview](#overview)
21
-
-[User experience when using this sample](#user-experience-when-using-this-sample)
19
+
-[Scenario](#scenario)
20
+
-[Overview](#overview)
21
+
-[User experience when using this sample](#user-experience-when-using-this-sample)
22
22
-[How to run this sample](#how-to-run-this-sample)
23
-
-[Step 1: In the downloaded folder](#step-1--in-the-downloaded-folder)
24
-
-[Step 2: Register the sample application with your Azure Active Directory tenant](#step-2--register-the-sample-application-with-your-azure-active-directory-tenant)
25
-
-[Step 3: Configure the sample to use your Azure AD tenant](#step-3--configure-the-sample-to-use-your-azure-ad-tenant)
26
-
-[Step 4: Run the sample](#step-4-run-the-sample)
27
-
-[Troubleshooting](#troubleshooting)
23
+
-[Step 1: In the downloaded folder](#step-1-in-the-downloaded-folder)
24
+
-[Step 2: Register the sample application with your Azure Active Directory tenant](#step-2-register-the-sample-application-with-your-azure-active-directory-tenant)
25
+
-[Step 3: Run the sample](#step-3-run-the-sample)
28
26
-[How was the code created](#how-was-the-code-created)
29
27
-[Choosing which scopes to expose](#choosing-which-scopes-to-expose)
30
28
-[Next chapter of the tutorial: the Web API itself calls another downstream Web API](#next-chapter-of-the-tutorial-the-web-api-itself-calls-another-downstream-web-api)
31
-
-[How to deploy this sample to Azure](#how-to-deploy-this-sample-to-azure)
32
29
-[Community Help and Support](#community-help-and-support)
33
30
-[Contributing](#contributing)
34
31
-[More information](#more-information)
@@ -76,7 +73,7 @@ cd "1. Desktop app calls Web API"
76
73
77
74
There are two projects in this sample. Each needs to be separately registered in your Azure AD tenant. To register these projects, you can:
78
75
79
-
- either follow the steps [Step 2: Register the sample with your Azure Active Directory tenant](#step-2-register-the-sample-with-your-azure-active-directory-tenant) and [Step 3: Configure the sample to use your Azure AD tenant](#choose-the-azure-ad-tenant-where-you-want-to-create-your-applications)
76
+
- either follow the steps below for manual registration
80
77
- or use PowerShell scripts that:
81
78
-**automatically** creates the Azure AD applications and related objects (passwords, permissions, dependencies) for you. Note that this works for Visual Studio only.
82
79
- modify the Visual Studio projects' configuration files.
@@ -119,7 +116,6 @@ As a first step you'll need to:
119
116
120
117
#### Register the service app (TodoListService (active-directory-dotnet-native-aspnetcore-v2))
121
118
122
-
123
119
1. Navigate to the Microsoft identity platform for developers [App registrations](https://go.microsoft.com/fwlink/?linkid=2083908) page.
124
120
1. Select **New registration**.
125
121
1. In the **Register an application page** that appears, enter your application's registration information:
@@ -143,10 +139,10 @@ The first thing that we need to do is to declare the unique [resource](https://d
143
139
- Keep **State** as **Enabled**
144
140
- Click on the **Add scope** button on the bottom to save this scope.
145
141
146
-
#####Configure the service app (TodoListService (active-directory-dotnet-native-aspnetcore-v2)) to use your app registration
142
+
#### Configure the service app (TodoListService (active-directory-dotnet-native-aspnetcore-v2)) to use your app registration
147
143
148
144
Open the project in your IDE (like Visual Studio) to configure the code.
149
-
>In the steps below, "ClientID" is the same as "Application ID" or "AppId".
145
+
>In the steps below, "ClientID" is the same as "Application ID" or "AppId".
150
146
151
147
1. Open the `TodoListService\appsettings.json` file
152
148
2. Find the app key `Domain` and replace the existing value with your Azure AD tenant name.
@@ -165,7 +161,6 @@ Open the project in your IDE (like Visual Studio) to configure the code.
165
161
1. In the app's registration screen, select **Authentication** in the menu.
166
162
- If you don't have a platform added, select **Add a platform** and select the **Public client (mobile & desktop)** option.
167
163
- In the **Redirect URIs** | **Suggested Redirect URIs for public clients (mobile, desktop)** section, select **https://login.microsoftonline.com/common/oauth2/nativeclient**
168
-
169
164
1. Select **Save** to save your changes.
170
165
1. In the app's registration screen, click on the **API permissions** blade in the left to open the page where we add access to the Apis that your application needs.
171
166
- Click the **Add a permission** button and then,
@@ -174,17 +169,17 @@ Open the project in your IDE (like Visual Studio) to configure the code.
174
169
- In the **Delegated permissions** section, select the **access_as_user** in the list. Use the search box if necessary.
175
170
- Click on the **Add permissions** button at the bottom.
176
171
177
-
#####Configure the client app (TodoListClient (active-directory-dotnet-native-aspnetcore-v2)) to use your app registration
172
+
#### Configure the client app (TodoListClient (active-directory-dotnet-native-aspnetcore-v2)) to use your app registration
178
173
179
174
Open the project in your IDE (like Visual Studio) to configure the code.
180
-
>In the steps below, "ClientID" is the same as "Application ID" or "AppId".
175
+
>In the steps below, "ClientID" is the same as "Application ID" or "AppId".
181
176
1. Open the `TodoListClient\App.Config` file
182
-
1. Find the app key `ida:Tenant` and replace the existing value with your Azure AD tenant name.
183
-
1. Find the app key `ida:ClientId` and replace the existing value with the application ID (clientId) of the `TodoListClient (active-directory-dotnet-native-aspnetcore-v2)` application copied from the Azure portal.
184
-
1. Find the app key `todo:TodoListScope` and replace the existing value with Scope.
185
-
1. Find the app key `todo:TodoListBaseAddress` and replace the existing value with the base address of the TodoListService (active-directory-dotnet-native-aspnetcore-v2) project (by default `https://localhost:44351/`).
177
+
2. Find the app key `ida:Tenant` and replace the existing value with your Azure AD tenant name.
178
+
3. Find the app key `ida:ClientId` and replace the existing value with the application ID (clientId) of the `TodoListClient (active-directory-dotnet-native-aspnetcore-v2)` application copied from the Azure portal.
179
+
4. Find the app key `todo:TodoListScope` and replace the existing value with Scope.
180
+
5. Find the app key `todo:TodoListBaseAddress` and replace the existing value with the base address of the TodoListService (active-directory-dotnet-native-aspnetcore-v2) project (by default `https://localhost:44351/`).
186
181
187
-
### Step 4: Run the sample
182
+
### Step 3: Run the sample
188
183
189
184
Clean the solution, rebuild the solution, and run it. You might want to go into the solution properties and set both projects as startup projects, with the service project starting first.
190
185
@@ -340,7 +335,7 @@ See [2. Web API now calls Microsoft Graph](../2.%20Web%20API%20now%20calls%20Mic
340
335
341
336
Use [Stack Overflow](http://stackoverflow.com/questions/tagged/msal) to get support from the community.
342
337
Ask your questions on Stack Overflow first and browse existing issues to see if someone has asked your question before.
343
-
Make sure that your questions or comments are tagged with [`msal``dotnet`].
338
+
Make sure that your questions or comments are tagged with [`azure-active-directory``msal``dotnet`].
344
339
345
340
To provide a recommendation, visit the following [User Voice page](https://feedback.azure.com/forums/169401-azure-active-directory).
0 commit comments