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/app-service/configure-authentication-provider-aad.md
+23-21Lines changed: 23 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,21 +19,21 @@ This article shows you how to configure authentication for Azure App Service or
19
19
20
20
## Choose a tenant for your application and its users
21
21
22
-
Before your application can sign in users, you first need to register it in a workforce or external tenant. If you are making your app available to employee or business guests, register your app in a workforce tenant. If your app is for consumers and business customers, register it in an external tenant.
22
+
Before your application can sign in users, you first need to register it in a workforce or external tenant. If you're making your app available to employee or business guests, register your app in a workforce tenant. If your app is for consumers and business customers, register it in an external tenant.
23
23
24
24
1. Sign in to the [Azure portal] and navigate to your app.
25
25
26
26
1. On your app's left menu, select **Authentication**, and then select **Add identity provider**.
27
27
28
28
1. In the **Add an identity provider** page, select **Microsoft** as the **Identity provider** to sign in Microsoft and Microsoft Entra identities.
29
29
30
-
1. For **Tenant type**, select select **Workforce configuration (current tenant)** for employees and business guests or select **External configuration** for consumers and business customers.
30
+
1. For **Tenant type**, select **Workforce configuration (current tenant)** for employees and business guests or select **External configuration** for consumers and business customers.
31
31
32
32
## Choose the app registration
33
33
34
34
The App Service Authentication feature can automatically create an app registration for you or you can use a registration that you or a directory admin created separately.
35
35
36
-
Create a new app registration automatically, unless you need to create an app registration separately. You can customize the app registration in the [Microsoft Entra admin center](https://entra.microsoft.com)once it's created.
36
+
Create a new app registration automatically, unless you need to create an app registration separately. You can customize the app registration in the [Microsoft Entra admin center](https://entra.microsoft.com)later if you want.
37
37
38
38
The following situations are the most common cases to use an existing app registration:
39
39
@@ -43,9 +43,9 @@ The following situations are the most common cases to use an existing app regist
[Create a use a new app registration](#express) or [use an existing registration created separately](#advanced).
46
+
[Create and use a new app registration](#express) or [use an existing registration created separately](#advanced).
47
47
48
-
### <aname="express"> Option 1: Create and use a new app registration
48
+
### <aname="express"></a> Option 1: Create and use a new app registration
49
49
50
50
Use this option unless you need to create an app registration separately. You can customize the app registration in Microsoft Entra once it's created.
51
51
@@ -58,20 +58,20 @@ Select the **Supported account type**:
58
58
59
59
-**Current tenant - Single tenant**. Accounts in this organizational directory only. All user and guest accounts in your directory can use your application or API. Use this option if your target audience is internal to your organization.
60
60
-**Any Microsoft Entra directory - Multitenant**. Accounts in any organizational directory. All users with a work or school account from Microsoft can use your application or API. This includes schools and businesses that use Office 365. Use this option if your target audience is business or educational customers and to enable multitenancy.
61
-
-**Any Microsoft Entra directory & personal Microsoft accounts**. Accounts in any organizational directory and personal Microsoft accounts (e.g. Skype, Xbox). All users with a work or school, or personal Microsoft account can use your application or API. It includes schools and businesses that use Office 365 as well as personal accounts that are used to sign in to services like Xbox and Skype. Use this option to target the widest set of Microsoft identities and to enable multitenancy.
61
+
-**Any Microsoft Entra directory & personal Microsoft accounts**. Accounts in any organizational directory and personal Microsoft accounts (for example, Skype, Xbox). All users with a work or school, or personal Microsoft account can use your application or API. It includes schools and businesses that use Office 365 as well as personal accounts that are used to sign in to services like Xbox and Skype. Use this option to target the widest set of Microsoft identities and to enable multitenancy.
62
62
-**Personal Microsoft accounts only**. Personal accounts that are used to sign in to services like Xbox and Skype. Use this option to target the widest set of Microsoft identities.
63
63
64
64
You can change the name of the registration or the supported account types later if you want.
65
65
66
-
A client secret will be created and stored as a slot-sticky [application setting] named `MICROSOFT_PROVIDER_AUTHENTICATION_SECRET`. You can update that setting later to use [Key Vault references](./app-service-key-vault-references.md) if you wish to manage the secret in Azure Key Vault.
66
+
A client secret is created as a slot-sticky [application setting] named `MICROSOFT_PROVIDER_AUTHENTICATION_SECRET`. You can update that setting later to use [Key Vault references](./app-service-key-vault-references.md) if you wish to manage the secret in Azure Key Vault.
67
67
68
68
### <aname="advanced"> </a>Option 2: Use an existing registration created separately
69
69
70
70
Either:
71
-
- Select **Pick an existing app registration in this directory** and select an app registration from the dropdown.
72
-
- Select **Provide the details of an exsiting app registrion** and provide:
71
+
- Select **Pick an existing app registration in this directory** and select an app registration from the drop-down.
72
+
- Select **Provide the details of an existing app registration** and provide:
73
73
- Application (client) ID.
74
-
- Client secret (recommended). A secret value that the application uses to prove its identity when requesting a token. This value will be saved in your app's configuration as a slot-sticky application setting named `MICROSOFT_PROVIDER_AUTHENTICATION_SECRET`. If the client secret is not set, login operations from the service will use the OAuth 2.0 implicit grant flow which is *not* recommended.
74
+
- Client secret (recommended). A secret value that the application uses to prove its identity when requesting a token. This value is saved in your app's configuration as a slot-sticky application setting named `MICROSOFT_PROVIDER_AUTHENTICATION_SECRET`. If the client secret isn't set, sign-in operations from the service use the OAuth 2.0 implicit grant flow, which isn't* recommended.
75
75
- Issuer URL, which takes the form `<authentication-endpoint>/<tenant-id>/v2.0`. Replace `<authentication-endpoint>` with the authentication endpoint [value specific to the cloud environment](/entra/identity-platform/authentication-national-cloud#azure-ad-authentication-endpoints). For example, a workforce tenant in global Azure would use "https://login.microsoftonline.com" as its authentication endpoint.
76
76
77
77
If you need to manually create an app registration in a workforce tenant, follow the [register an application](/entra/identity-platform/quickstart-register-app) quickstart. As you go through the registration process, be sure to note the application (client) ID and client secret values.
@@ -82,7 +82,7 @@ After creation, modify the app registration:
82
82
83
83
1. From the left navigation, select **Expose an API** > **Add** > **Save**. This value uniquely identifies the application when it's used as a resource, allowing tokens to be requested that grant access. It's used as a prefix for scopes you create.
84
84
85
-
For a single-tenant app, you can use the default value, which is in the form `api://<application-client-id>`. You can also specify a more readable URI like `https://contoso.com/api` based on one of the verified domains for your tenant. For a multi-tenant app, you must provide a custom URI. To learn more about accepted formats for App ID URIs, see the [app registrations best practices reference](../active-directory/develop/security-best-practices-for-app-registration.md#application-id-uri).
85
+
For a single-tenant app, you can use the default value, which is in the form `api://<application-client-id>`. You can also specify a more readable URI like `https://contoso.com/api` based on one of the verified domains for your tenant. For a multitenant app, you must provide a custom URI. To learn more about accepted formats for App ID URIs, see the [app registrations best practices reference](../active-directory/develop/security-best-practices-for-app-registration.md#application-id-uri).
86
86
87
87
1. Select **Add a scope**.
88
88
1. In **Scope name**, enter *user_impersonation*.
@@ -99,23 +99,23 @@ After creation, modify the app registration:
99
99
100
100
[Create and use a new app registration](#express_external) or [use an existing registration created separately](#advanced).
101
101
102
-
### <aname="express_external"> Option 1: Create and use a new app registration
102
+
### <aname="express_external"></a> Option 1: Create and use a new app registration
103
103
104
104
Use this option unless you need to create an app registration separately. You can customize the app registration in Microsoft Entra once it's created.
105
105
106
106
Select **Create new app registration** to create a new app registration.
107
107
108
-
1. Select an existing tenant to use from the dropdown, or click**Create new** to create a new [customer (external) tenant](/entra/external-id/customers/quickstart-tenant-setup).
108
+
1. Select an existing tenant to use from the drop-down, or select**Create new** to create a new [customer (external) tenant](/entra/external-id/customers/quickstart-tenant-setup).
109
109
110
110
#### To create a new external tenant
111
111
112
-
1. In the **Create a tenant** page, add the **Tenant Name** and **Domain Name**. Select a **Location** and click**Review and create**. The tenant creation process will take a few minutes.
112
+
1. In the **Create a tenant** page, add the **Tenant Name** and **Domain Name**. Select a **Location** and select**Review and create**. The tenant creation process takes a few minutes.
113
113
114
114
1. Select **Configure** to **configure external authentication** for the new tenant.
115
115
116
116
1. The browser opens **Configure customer authentication**. In **Setup sign-in**, select **Create new** to create a sign-in experience for your external users.
117
117
118
-
1. Select a user flow from the dropdown or click**Create new**. The user flow defines the sign-in methods your external users can use. Each app can only have one user flow, but you can reuse the same user flow for multiple apps.
118
+
1. Select a user flow from the drop-down or select**Create new**. The user flow defines the sign-in methods your external users can use. Each app can only have one user flow, but you can reuse the same user flow for multiple apps.
119
119
120
120
##### To create a new user flow
121
121
@@ -138,8 +138,8 @@ Select **Create new app registration** to create a new app registration.
138
138
### <aname="advanced_external"> </a>Option 2: Use an existing registration created separately
139
139
140
140
Either:
141
-
- Select **Pick an existing app registration in this directory** and select an app registration from the dropdown
142
-
- Select **Provide the details of an exsiting app registrion** and provide:
141
+
- Select **Pick an existing app registration in this directory** and select an app registration from the drop-down
142
+
- Select **Provide the details of an existing app registration** and provide:
143
143
- Application (client) ID
144
144
- Client secret
145
145
- Issuer URL
@@ -200,6 +200,8 @@ For **Unauthenticated requests**
200
200
- HTTP 403 Forbidden
201
201
- HTTP 404 Not found
202
202
203
+
Select **Token store** (recommended). The token store collects, stores, and refreshes tokens for your application. You can disable this later if your app doesn't need tokens or you need to optimize performance.
204
+
203
205
## Add the identity provider
204
206
205
207
(Optional) Select **Next: Permissions** and add any Microsoft Graph permissions needed by the application. These will be added to the app registration, but you can also change them later.
@@ -221,7 +223,7 @@ Your app can [make authorization decisions in code](#perform-validations-from-ap
221
223
222
224
### Perform validations from application code
223
225
224
-
When you perform authorization checks in your app code, you can leverage the [claims information that App Service Authentication makes available](./configure-authentication-user-identities.md#access-user-claims-in-app-code). The injected `x-ms-client-principal` header contains a Base64-encoded JSON object with the claims asserted about the caller. By default, these claims go through a claims mapping, so the claim names may not always match what you would see in the token. For example, the `tid` claim is mapped to `http://schemas.microsoft.com/identity/claims/tenantid` instead.
226
+
When you perform authorization checks in your app code, you can use the [claims information that App Service Authentication makes available](./configure-authentication-user-identities.md#access-user-claims-in-app-code). The injected `x-ms-client-principal` header contains a Base64-encoded JSON object with the claims asserted about the caller. By default, these claims go through a claims mapping, so the claim names may not always match what you would see in the token. For example, the `tid` claim is mapped to `http://schemas.microsoft.com/identity/claims/tenantid` instead.
225
227
226
228
You can also work directly with the underlying access token from the injected `x-ms-token-aad-access-token` header.
227
229
@@ -253,7 +255,7 @@ Within the API object, the Microsoft Entra identity provider configuration has a
253
255
|`allowedPrincipals`| A grouping of checks that determine if the principal represented by the incoming request may access the app. Satisfaction of `allowedPrincipals` is based on a logical `OR` over its configured properties. |
254
256
|`identities` (under `allowedPrincipals`) | An allowlist of string **object IDs** representing users or applications that have access. When this property is configured as a nonempty array, the `allowedPrincipals` requirement can be satisfied if the user or application represented by the request is specified in the list. There's a limit of 500 characters total across the list of identities.<br/><br/>This policy evaluates the `oid` claim of the incoming token. See the [Microsoft identity platform claims reference]. |
255
257
256
-
Additionally, some checks can be configured through an [application setting], regardless of the API version being used. The `WEBSITE_AUTH_AAD_ALLOWED_TENANTS` application setting can be configured with a comma-separated list of up to 10 tenant IDs (e.g., "559a2f9c-c6f2-4d31-b8d6-5ad1a13f8330,5693f64a-3ad5-4be7-b846-e9d1141bcebc") to require that the incoming token is from one of the specified tenants, as specified by the `tid` claim. The `WEBSITE_AUTH_AAD_REQUIRE_CLIENT_SERVICE_PRINCIPAL` application setting can be configured to "true" or "1" to require the incoming token to include an `oid` claim. This setting is ignored and treated as true if `allowedPrincipals.identities` has been configured (since the `oid` claim is checked against this provided list of identities).
258
+
Additionally, some checks can be configured through an [application setting], regardless of the API version being used. The `WEBSITE_AUTH_AAD_ALLOWED_TENANTS` application setting can be configured with a comma-separated list of up to 10 tenant IDs (for example, "559a2f9c-c6f2-4d31-b8d6-5ad1a13f8330,5693f64a-3ad5-4be7-b846-e9d1141bcebc") to require that the incoming token is from one of the specified tenants, as specified by the `tid` claim. The `WEBSITE_AUTH_AAD_REQUIRE_CLIENT_SERVICE_PRINCIPAL` application setting can be configured to "true" or "1" to require the incoming token to include an `oid` claim. This setting is ignored and treated as true if `allowedPrincipals.identities` has been configured (since the `oid` claim is checked against this provided list of identities).
257
259
258
260
Requests that fail these built-in checks are given an HTTP `403 Forbidden` response.
259
261
@@ -277,7 +279,7 @@ You can register native clients to request access your App Service app's APIs on
277
279
> [!NOTE]
278
280
> For a Microsoft Store application, use the [package SID](/previous-versions/azure/app-service-mobile/app-service-mobile-dotnet-how-to-use-client-library#package-sid) as the URI instead.
279
281
1. From the left navigation, select **API permissions** > **Add a permission** > **My APIs**.
280
-
1. Select the app registration you created earlier for your App Service app. If you don't see the app registration, make sure that you've added the **user_impersonation** scope in [Create an app registration in Microsoft Entra for your App Service app](#register).
282
+
1. Select the app registration you created earlier for your App Service app. If you don't see the app registration, make sure that you've added the **user_impersonation** scope in the app registration.
281
283
1. Under **Delegated permissions**, select **user_impersonation**, and then select **Add permissions**.
282
284
283
285
You have now configured a native client application that can request access your App Service app on behalf of a user.
@@ -312,7 +314,7 @@ You have now configured a daemon client application that can access your App Ser
312
314
313
315
## Best practices
314
316
315
-
Regardless of the configuration you use to set up authentication, the following best practices will keep your tenant and applications more secure:
317
+
Regardless of the configuration you use to set up authentication, the following best practices keep your tenant and applications more secure:
316
318
317
319
- Configure each App Service app with its own app registration in Microsoft Entra.
318
320
- Give each App Service app its own permissions and consent.
0 commit comments