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: 4-WebApp-your-API/4-3-AnyOrg/Readme.md
+20-20Lines changed: 20 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ description: "Protect a multi-tenant SaaS web application and a Web API which ca
44
44
45
45
## About this sample
46
46
47
-
This sample demonstrates how to protect a **multi-tenant** ASP.NET Core MVC web application (TodoListClient) which calls another **multi-tenant** ASP.NET Core Web API (TodoListService) with Microsoft Identity Platform. This sample builds on the concepts introduced in the [Build a multi-tenant SaaS web application that calls Microsoft Graph using Azure AD & OpenID Connect](../../../2-WebApp-graph-user\2-3-Multi-Tenant/README.md) sample. We advise you go through that sample once before trying this sample.
47
+
This sample demonstrates how to protect a **multi-tenant** ASP.NET Core MVC web application (TodoListClient) which calls another **multi-tenant** ASP.NET Core Web API (ToDoListService) with Microsoft Identity Platform. This sample builds on the concepts introduced in the [Build a multi-tenant SaaS web application that calls Microsoft Graph using Azure AD & OpenID Connect](../../../2-WebApp-graph-user\2-3-Multi-Tenant/README.md) sample. We advise you go through that sample once before trying this sample.
48
48
49
49
### Scenario
50
50
@@ -140,12 +140,12 @@ As a first step you'll need to:
140
140
1. Sign in to the [Azure portal](https://portal.azure.com).
141
141
1. If your account is present in more than one Azure AD tenant, select your profile at the top right corner in the menu on top of the page, and then **switch directory** to change your portal session to the desired Azure AD tenant..
142
142
143
-
#### Register the service app (WebApi-MultiTenant-TodoListService-v2)
143
+
#### Register the service app (WebApi-MultiTenant-ToDoListService-v2)
144
144
145
145
1. Navigate to the Microsoft identity platform for developers [App registrations](https://go.microsoft.com/fwlink/?linkid=2083908) page.
146
146
1. Select **New registration**.
147
147
1. In the **Register an application page** that appears, enter your application's registration information:
148
-
- In the **Name** section, enter a meaningful application name that will be displayed to users of the app, for example `WebApi-MultiTenant-TodoListService-v2`.
148
+
- In the **Name** section, enter a meaningful application name that will be displayed to users of the app, for example `WebApi-MultiTenant-ToDoListService-v2`.
149
149
- Under **Supported account types**, select **Accounts in any organizational directory**.
150
150
- In the **Redirect URI (optional)** section, select **Web** in the combo-box and enter the following redirect URI: `https://localhost:44351/api/Home`.
151
151
1. Select **Register** to create the application.
@@ -171,24 +171,24 @@ The first thing that we need to do is to declare the unique [resource](https://d
171
171
- Select **Add a scope** button open the **Add a scope** screen and Enter the values as indicated below:
172
172
- For **Scope name**, use `access_as_user`.
173
173
- Select **Admins and users** options for **Who can consent?**
174
-
- For **Admin consent display name** type `Access WebApi-MultiTenant-TodoListService-v2`
175
-
- For **Admin consent description** type `Allows the app to access WebApi-MultiTenant-TodoListService-v2 as the signed-in user.`
176
-
- For **User consent display name** type `Access WebApi-MultiTenant-TodoListService-v2`
177
-
- For **User consent description** type `Allow the application to access WebApi-MultiTenant-TodoListService-v2 on your behalf.`
174
+
- For **Admin consent display name** type `Access WebApi-MultiTenant-ToDoListService-v2`
175
+
- For **Admin consent description** type `Allows the app to access WebApi-MultiTenant-ToDoListService-v2 as the signed-in user.`
176
+
- For **User consent display name** type `Access WebApi-MultiTenant-ToDoListService-v2`
177
+
- For **User consent description** type `Allow the application to access WebApi-MultiTenant-ToDoListService-v2 on your behalf.`
178
178
- Keep **State** as **Enabled**
179
179
- Click on the **Add scope** button on the bottom to save this scope.
180
180
181
-
#### Configure the service app (WebApi-MultiTenant-TodoListService-v2) to use your app registration
181
+
#### Configure the service app (WebApi-MultiTenant-ToDoListService-v2) to use your app registration
182
182
183
183
Open the project in your IDE (like Visual Studio or Visual Studio Code) to configure the code.
184
184
185
185
>In the steps below, "ClientID" is the same as "Application ID" or "AppId".
186
186
187
-
1. Open the `TodoListService\appsettings.json` file
187
+
1. Open the `ToDoListService\appsettings.json` file
188
188
1. Find the app key `Domain` and replace the existing value with your Azure AD tenant name.
189
189
1. Find the app key `TenantId` and replace the existing value with 'common'.
190
-
1. Find the app key `ClientId` and replace the existing value with the application ID (clientId) of the `WebApi-MultiTenant-TodoListService-v2` application copied from the Azure portal.
191
-
1. Find the app key `ClientSecret` and replace the existing value with the key you saved during the creation of the `WebApi-MultiTenant-TodoListService-v2` app, in the Azure portal.
190
+
1. Find the app key `ClientId` and replace the existing value with the application ID (clientId) of the `WebApi-MultiTenant-ToDoListService-v2` application copied from the Azure portal.
191
+
1. Find the app key `ClientSecret` and replace the existing value with the key you saved during the creation of the `WebApi-MultiTenant-ToDoListService-v2` app, in the Azure portal.
192
192
193
193
#### Register the client app (WebApp-MultiTenant-ToDoListClient-v2)
194
194
@@ -216,8 +216,8 @@ Open the project in your IDE (like Visual Studio or Visual Studio Code) to confi
216
216
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.
217
217
- Click the **Add a permission** button and then,
218
218
- Ensure that the **My APIs** tab is selected.
219
-
- In the list of APIs, select the API `WebApi-MultiTenant-TodoListService-v2`.
220
-
- In the **Delegated permissions** section, select the **Access 'WebApi-MultiTenant-TodoListService-v2'** in the list. Use the search box if necessary.
219
+
- In the list of APIs, select the API `WebApi-MultiTenant-ToDoListService-v2`.
220
+
- In the **Delegated permissions** section, select the **Access 'WebApi-MultiTenant-ToDoListService-v2'** in the list. Use the search box if necessary.
221
221
- Click on the **Add permissions** button at the bottom.
222
222
223
223
#### Configure the client app (WebApp-MultiTenant-ToDoListClient-v2) to use your app registration
@@ -233,8 +233,8 @@ Open the project in your IDE (like Visual Studio or Visual Studio Code) to confi
233
233
1. Find the app key `ClientSecret` and replace the existing value with the key you saved during the creation of the `WebApp-MultiTenant-ToDoListClient-v2` app, in the Azure portal.
234
234
1. Find the app key `RedirectUri` and replace the existing value with the base address of the WebApp-MultiTenant-ToDoListClient-v2 project (by default `https://localhost:44321/`).
235
235
1. Find the app key `TodoListScope` and replace the existing value with ScopeDefault.
236
-
1. Find the app key `TodoListAppId` and replace the existing value with the application ID (clientId) of the `WebApi-MultiTenant-TodoListService-v2` application copied from the Azure portal.
237
-
1. Find the app key `TodoListBaseAddress` and replace the existing value with the base address of the WebApi-MultiTenant-TodoListService-v2 project (by default `https://localhost:44351/`).
236
+
1. Find the app key `TodoListAppId` and replace the existing value with the application ID (clientId) of the `WebApi-MultiTenant-ToDoListService-v2` application copied from the Azure portal.
237
+
1. Find the app key `TodoListBaseAddress` and replace the existing value with the base address of the WebApi-MultiTenant-ToDoListService-v2 project (by default `https://localhost:44351/`).
238
238
1. Find the app key `AdminConsentRedirectApi` and replace the existing value with "https://localhost:44351/api/Home".
239
239
240
240
### Step 3: Run the sample
@@ -257,7 +257,7 @@ This behavior is expected as the browser is not authenticated. The Web applicati
257
257
##### Step 1. Install .NET Core dependencies
258
258
259
259
```console
260
-
cd TodoListService
260
+
cd ToDoListService
261
261
dotnet restore
262
262
```
263
263
@@ -289,7 +289,7 @@ In both the console windows execute the below command:
289
289
290
290
Open your browser and navigate to `https://localhost:44321`.
291
291
292
-
> NOTE: Remember, the To-Do list is stored in memory in this `TodoListService` app. Each time you run the projects, your To-Do list will get emptied.
292
+
> NOTE: Remember, the To-Do list is stored in memory in this `ToDoListService` app. Each time you run the projects, your To-Do list will get emptied.
### Provisioning your Multi-tenant Apps in another Azure AD Tenant programatically
367
367
368
-
Often the user-based consent will be disabled in an Azure AD tenant or your application will be requesting permissions that requires a tenant-admin consent. In these scenarios, your application will need to utilize the `/adminconsent` endpoint to provision both the **ToDoListClient** and the **TodoListService** before the users from that tenant are able to sign-in to your app.
368
+
Often the user-based consent will be disabled in an Azure AD tenant or your application will be requesting permissions that requires a tenant-admin consent. In these scenarios, your application will need to utilize the `/adminconsent` endpoint to provision both the **ToDoListClient** and the **ToDoListService** before the users from that tenant are able to sign-in to your app.
369
369
370
-
When provisioning, you have to take care of the dependency in the topology where the **ToDoListClient** is dependent on **TodoListService**. So in such a case, you would provision the **TodoListService** before the **ToDoListClient**.
370
+
When provisioning, you have to take care of the dependency in the topology where the **ToDoListClient** is dependent on **ToDoListService**. So in such a case, you would provision the **ToDoListService** before the **ToDoListClient**.
371
371
372
372
### Code for the Web App (TodoListClient)
373
373
@@ -466,7 +466,7 @@ public async Task<IActionResult> Create()
0 commit comments