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: articles/active-directory/develop/scenario-web-app-sign-user-app-configuration.md
+15-18Lines changed: 15 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ ms.service: active-directory
9
9
ms.subservice: develop
10
10
ms.topic: conceptual
11
11
ms.workload: identity
12
-
ms.date: 07/14/2020
12
+
ms.date: 12/8/2022
13
13
ms.author: jmprieur
14
14
ms.custom: aaddev, devx-track-python
15
15
#Customer intent: As an application developer, I want to know how to write a web app that signs in users by using the Microsoft identity platform.
@@ -64,8 +64,16 @@ You might want to refer to this sample for full implementation details.
64
64
65
65
Web applications that sign in users by using the Microsoft identity platform are configured through configuration files. These are the values you're required to specify in the configuration:
66
66
67
-
- The cloud instance (`Instance`) if you want your app to run in national clouds, for example
68
-
- The audience in the tenant ID (`TenantId`)
67
+
- The cloud instance (`Instance`) if you want your app to run in national clouds, for example. The different options include;
68
+
-`https://login.microsoftonline.com/` for Azure public cloud
69
+
-`https://login.microsoftonline.us/` for Azure US government
70
+
-`https://login.microsoftonline.de/` for Azure AD Germany
71
+
-`https://login.partner.microsoftonline.cn/common` for Azure AD China operated by 21Vianet
72
+
- The audience in the tenant ID (`TenantId`). The options vary depending on whether your app is single tenant or multitenant.
73
+
-`TenantId` for a GUID obtained from the Azure portal to sign in users in your organization
74
+
-`organizations` to sign in users in any work or school account
75
+
-`common` to sign in users with any work or school account or Microsoft personal account
76
+
-`consumers` to sign in users with a Microsoft personal account only
69
77
- The client ID (`ClientId`) for your application, as copied from the Azure portal
70
78
71
79
You might also see references to the `Authority`. The `Authority` value is the concatenation of the `Instance` and `TenantId` values.
@@ -77,18 +85,7 @@ In ASP.NET Core, these settings are located in the [appsettings.json](https://gi
77
85
```Json
78
86
{
79
87
"AzureAd": {
80
-
// Azure cloud instance among:
81
-
// - "https://login.microsoftonline.com/" for Azure public cloud
82
-
// - "https://login.microsoftonline.us/" for Azure US government
83
-
// - "https://login.microsoftonline.de/" for Azure AD Germany
84
-
// - "https://login.partner.microsoftonline.cn/common" for Azure AD China operated by 21Vianet
85
88
"Instance": "https://login.microsoftonline.com/",
86
-
87
-
// Azure AD audience among:
88
-
// - "TenantId" as a GUID obtained from the Azure portal to sign in users in your organization
89
-
// - "organizations" to sign in users in any work or school account
90
-
// - "common" to sign in users with any work or school account or Microsoft personal account
91
-
// - "consumers" to sign in users with a Microsoft personal account only
92
89
"TenantId": "[Enter the tenantId here]",
93
90
94
91
// Client ID (application ID) obtained from the Azure portal
@@ -131,7 +128,7 @@ In ASP.NET Core, another file ([properties\launchSettings.json](https://github.c
131
128
}
132
129
```
133
130
134
-
In the Azure portal, the redirect URIs that you register on the **Authentication** page for your application need to match these URLs. For the two preceding configuration files, they would be `https://localhost:44321/signin-oidc`. The reason is that `applicationUrl` is `http://localhost:3110`, but `sslPort` is specified (44321). `CallbackPath` is `/signin-oidc`, as defined in `appsettings.json`.
131
+
In the Azure portal, the redirect URIs that you register on the **Authentication** page for your application need to match these URLs. For the two preceding configuration files, they would be `https://localhost:44321/signin-oidc`. The reason is that `applicationUrl` is `http://localhost:3110`, but `sslPort` is specified (`44321`). `CallbackPath` is `/signin-oidc`, as defined in `appsettings.json`.
135
132
136
133
In the same way, the sign-out URI would be set to `https://localhost:44321/signout-oidc`.
137
134
> [!NOTE]
@@ -218,7 +215,7 @@ SESSION_TYPE = "filesystem" # So the token cache will be stored in a server-sid
218
215
219
216
## Initialization code
220
217
221
-
The initialization code is different depending on the platform. For ASP.NET Core andASP.NET, signing in users is delegated to the OpenID Connect middleware. The ASP.NETorASP.NET Core template generates web applications for the Azure Active Directory (Azure AD) v1.0 endpoint. Some configuration is required to adapt them to the Microsoft identity platform. In the case of Java, it's handled by Spring with the cooperation of the application.
218
+
The initialization code differences are platform dependant. For ASP.NET Core andASP.NET, signing in users is delegated to the OpenID Connect middleware. The ASP.NETorASP.NET Core template generates web applications for the Azure Active Directory (Azure AD) v1.0 endpoint. Some configuration is required to adapt them to the Microsoft identity platform.
222
219
223
220
# [ASP.NET Core](#tab/aspnetcore)
224
221
@@ -227,7 +224,7 @@ In ASP.NET Core web apps (and web APIs), the application is protected because yo
227
224
To add authentication with the Microsoft identity platform (formerly Azure AD v2.0), you'll need to add the following code. The comments in the code should be self-explanatory.
228
225
229
226
> [!NOTE]
230
-
> If you want to start directly with the new ASP.NET Core templates for Microsoft identity platform, that leverage Microsoft.Identity.Web, you can download a preview NuGet package containing project templates for .NETCore 3.1and .NET5.0. Then, once installed, you can directly instantiate ASP.NET Core web applications (MVCor Blazor). See [Microsoft.Identity.Web web app project templates](https://aka.ms/ms-id-web/webapp-project-templates) for details. This is the simplest approach as it will do all the steps below for you.
227
+
> If you want to start directly with the new ASP.NET Core templates for Microsoft identity platform, that leverage Microsoft.Identity.Web, you can download a preview NuGet package containing project templates for .NET5.0. Then, once installed, you can directly instantiate ASP.NET Core web applications (MVCor Blazor). See [Microsoft.Identity.Web web app project templates](https://aka.ms/ms-id-web/webapp-project-templates) for details. This is the simplest approach as it will do all the steps below for you.
231
228
>
232
229
> If you prefer to start your project with the current default ASP.NET Core web project within Visual Studio or by using `dotnet new mvc --auth SingleOrg`or`dotnet new webapp --auth SingleOrg`, you'll see code like the following:
233
230
>
@@ -381,7 +378,7 @@ Move on to the next article in this scenario,
0 commit comments