Skip to content

Commit 572bdac

Browse files
AI Freshness Edit: App Service
1 parent 32e5202 commit 572bdac

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

articles/app-service/overview-authentication-authorization.md

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,43 @@
11
---
22
title: Authentication and Authorization
3-
description: Learn about the built-in authentication and authorization support in Azure App Service and Azure Functions, and how it can help secure your app against unauthorized access.
3+
description: Learn about the built-in authentication and authorization support in Azure App Service and Azure Functions, and how it can help secure your app.
44
ms.assetid: b7151b57-09e5-4c77-a10c-375a262f17e5
55
ms.topic: conceptual
6-
ms.date: 09/27/2024
6+
ms.date: 03/28/2025
77
ms.reviewer: mahender
88
ms.custom: UpdateFrequency3, fasttrack-edit, AppServiceIdentity
99
author: cephalin
1010
ms.author: cephalin
11+
#customer intent: As an app developer, I want to user Easy Auth to simplify authentication and authorization for my apps in Azure App Service.
1112
---
1213
# Authentication and authorization in Azure App Service and Azure Functions
1314

14-
[!INCLUDE [regionalization-note](./includes/regionalization-note.md)]
15+
Azure App Service provides built-in authentication (signing in users) and authorization (providing access to secure data) capabilities. These capabilities are sometimes called *Easy Auth*. You can use them to sign in users and access data by writing little or no code in your web app, RESTful API, mobile server, and [functions](../azure-functions/functions-overview.md).
1516

16-
Azure App Service provides built-in authentication (signing in users) and authorization (providing access to secure data) capabilities. These capabilities are sometimes called *Easy Auth*. You can use them to sign in users and access data by writing minimal or no code in your web app, RESTful API, mobile back end, and [functions](../azure-functions/functions-overview.md).
17+
[!INCLUDE [regionalization-note](./includes/regionalization-note.md)]
1718

1819
This article describes how App Service helps simplify authentication and authorization for your app.
1920

2021
## Reasons to use built-in authentication
2122

22-
To implement authentication and authorization, you can use the bundled security features in your web framework of choice, or you can write your own tools. However, implementing a secure solution for authentication and authorization can take significant effort. You need to follow industry best practices and standards. You also need to ensure that your solution stays up to date with the latest security, protocol, and browser updates.
23+
To implement authentication and authorization, you can use the bundled security features in your web framework of choice, or you can write your own tools. Implementing a secure solution for authentication and authorization can take significant effort. You need to follow industry best practices and standards. You also need to ensure that your solution stays up to date with the latest security, protocol, and browser updates.
2324

2425
The built-in capabilities of App Service and Azure Functions can save you time and effort by providing out-of-the-box authentication with federated identity providers, so you can focus on the rest of your application.
2526

26-
With App Service, you can integrate a variety of authentication capabilities into your web app or API without implementing them yourself. This feature is built directly into the platform and doesn't require any particular language, SDK, security expertise, or code. You can integrate it with multiple login providers, such as Microsoft Entra, Facebook, Google, and X.
27+
With App Service, you can integrate authentication capabilities into your web app or API without implementing them yourself. This feature is built directly into the platform and doesn't require any particular language, SDK, security expertise, or code. You can integrate it with multiple sign-in providers, such as Microsoft Entra, Facebook, Google, and X.
2728

28-
Your app might need to support more complex scenarios, such as Visual Studio integration or incremental consent. Several authentication solutions are available to support these scenarios. To learn more, read [Authentication scenarios and recommendations](identity-scenarios.md).
29+
Your app might need to support more complex scenarios, such as Visual Studio integration or incremental consent. Several authentication solutions are available to support these scenarios. To learn more, see [Authentication scenarios and recommendations](identity-scenarios.md).
2930

3031
## Identity providers
3132

32-
App Service uses [federated identity](https://en.wikipedia.org/wiki/Federated_identity), in which a third-party identity provider manages the user identities and authentication flow for you. The following identity providers are available by default:
33+
App Service uses [federated identity](https://en.wikipedia.org/wiki/Federated_identity). A Microsoft or non-Microsoft identity provider manages the user identities and authentication flow for you. The following identity providers are available by default:
3334

3435
| Provider | Sign-in endpoint | How-to guidance |
35-
| - | - | - |
36+
|:- |:- |:- |
3637
| [Microsoft Entra](/entra/index) | `/.auth/login/aad` | [App Service Microsoft Entra platform sign-in](configure-authentication-provider-aad.md) |
37-
| [Facebook](https://developers.facebook.com/docs/facebook-login) | `/.auth/login/facebook` | [App Service Facebook login](configure-authentication-provider-facebook.md) |
38+
| [Facebook](https://developers.facebook.com/docs/facebook-login) | `/.auth/login/facebook` | [App Service Facebook sign-in](configure-authentication-provider-facebook.md) |
3839
| [Google](https://developers.google.com/identity/choose-auth) | `/.auth/login/google` | [App Service Google sign-in](configure-authentication-provider-google.md) |
39-
| [X](https://developer.x.com/en/docs/basics/authentication) | `/.auth/login/x` | [App Service X login](configure-authentication-provider-twitter.md) |
40+
| [X](https://developer.x.com/en/docs/basics/authentication) | `/.auth/login/x` | [App Service X sign-in](configure-authentication-provider-twitter.md) |
4041
| [GitHub](https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app) | `/.auth/login/github` | [App Service GitHub sign-in](configure-authentication-provider-github.md) |
4142
| [Apple](https://developer.apple.com/sign-in-with-apple/) | `/.auth/login/apple` | [App Service sign-in via Apple sign-in (preview)](configure-authentication-provider-apple.md) |
4243
| Any [OpenID Connect](https://openid.net/connect/) provider | `/.auth/login/<providerName>` | [App Service OpenID Connect sign-in](configure-authentication-provider-openid-connect.md) |
@@ -47,7 +48,7 @@ When you configure this feature with one of these providers, its sign-in endpoin
4748

4849
Enabling built-in authentication causes all requests to your application to be automatically redirected to HTTPS, regardless of the App Service configuration setting to enforce HTTPS. You can disable this automatic redirection by using the `requireHttps` setting in the V2 configuration. However, we recommend that you keep using HTTPS and ensure that no security tokens are ever transmitted over nonsecure HTTP connections.
4950

50-
You can use App Service for authentication with or without restricting access to your site content and APIs. Set access restrictions in the **Authentication** > **Authentication settings** section of your web app:
51+
You can use App Service for authentication with or without restricting access to your site content and APIs. Set access restrictions in the **Settings** > **Authentication** > **Authentication settings** section of your web app:
5152

5253
- To restrict app access to only authenticated users, set **Action to take when request is not authenticated** to sign in with one of the configured identity providers.
5354
- To authenticate but not restrict access, set **Action to take when request is not authenticated** to **Allow anonymous requests (no action)**.
@@ -59,7 +60,7 @@ You can use App Service for authentication with or without restricting access to
5960

6061
### Feature architecture
6162

62-
The authentication and authorization middleware component is a feature of the platform that runs on the same virtual machine as your application. When it's enabled, every incoming HTTP request passes through it before your application handles it.
63+
The authentication and authorization middleware component is a feature of the platform that runs on the same virtual machine as your application. When you enable it, every incoming HTTP request passes through that component before your application handles it.
6364

6465
:::image type="content" source="media/app-service-authentication-overview/architecture.png" alt-text="Architecture diagram that shows a process in the site sandbox interacting with identity providers before allowing traffic to the deployed site." lightbox="media/app-service-authentication-overview/architecture.png":::
6566

@@ -74,20 +75,21 @@ The module runs separately from your application code. You can configure it by u
7475

7576
#### Feature architecture on Windows (non-container deployment)
7677

77-
The authentication and authorization module runs as a native [IIS module](/iis/get-started/introduction-to-iis/iis-modules-overview) in the same sandbox as your application. When it's enabled, every incoming HTTP request passes through it before your application handles it.
78+
The authentication and authorization module runs as a native [IIS module](/iis/get-started/introduction-to-iis/iis-modules-overview) in the same sandbox as your application. When you enable it, every incoming HTTP request passes through it before your application handles it.
7879

7980
#### Feature architecture on Linux and containers
8081

81-
The authentication and authorization module runs in a separate container that's isolated from your application code. By using the [Ambassador pattern](/azure/architecture/patterns/ambassador), the module interacts with the incoming traffic to perform similar functionality as on Windows. Because it doesn't run in process, no direct integration with specific language frameworks is possible. However, the relevant information that your app needs is passed through via request headers.
82+
The authentication and authorization module runs in a separate container that's isolated from your application code. The module uses the [Ambassador pattern](/azure/architecture/patterns/ambassador) to interact with the incoming traffic to perform similar functionality as on Windows. Because it doesn't run in process, no direct integration with specific language frameworks is possible. However, the relevant information that your app needs is passed through in request headers.
8283

8384
### Authentication flow
8485

85-
The authentication flow is the same for all providers, but it differs depending on whether you want to sign in with the provider's SDK:
86+
The authentication flow is the same for all providers. It differs depending on whether you want to sign in with the provider's SDK:
8687

8788
- **Without provider SDK**: The application delegates federated sign-in to App Service. This delegation is typically the case with browser apps, which can present the provider's sign-in page to the user. The server code manages the sign-in process, so it's also called *server-directed flow* or *server flow*.
8889

8990
This case applies to browser apps and mobile apps that use an embedded browser for authentication.
90-
- **With provider SDK**: The application signs in users to the provider manually, and then it submits the authentication token to App Service for validation. This process is typically the case with browserless apps, which can't present the provider's sign-in page to the user. The application code manages the sign-in process, so it's also called *client-directed flow* or *client flow*.
91+
92+
- **With provider SDK**: The application signs in users to the provider manually. Then it submits the authentication token to App Service for validation. This process is typically the case with browserless apps, which can't present the provider's sign-in page to the user. The application code manages the sign-in process, so it's also called *client-directed flow* or *client flow*.
9193

9294
This case applies to REST APIs, [Azure Functions](../azure-functions/functions-overview.md), and JavaScript browser clients, in addition to browser apps that need more flexibility in the sign-in process. It also applies to native mobile apps that sign in users by using the provider's SDK.
9395

@@ -148,24 +150,24 @@ With the token store, you just [retrieve the tokens](configure-authentication-oa
148150

149151
The ID tokens, access tokens, and refresh tokens are cached for the authenticated session. Only the associated user can access them.
150152

151-
If you don't need to work with tokens in your app, you can disable the token store on your app's **Authentication** or **Authorization** page.
153+
If you don't need to work with tokens in your app, you can disable the token store on your app's **Settings** > **Authentication** page.
152154

153155
### Logging and tracing
154156

155157
If you [enable application logging](troubleshoot-diagnostic-logs.md), authentication and authorization traces appear directly in your log files. If you see an authentication error that you didn't expect, you can conveniently find all the details by looking in your existing application logs.
156158

157-
If you enable [failed request tracing](troubleshoot-diagnostic-logs.md), you can see exactly what role the authentication and authorization module might have played in a failed request. In the trace logs, look for references to a module named `EasyAuthModule_32/64`.
159+
If you enable [failed request tracing](troubleshoot-diagnostic-logs.md), you can see exactly what role the authentication and authorization module might play in a failed request. In the trace logs, look for references to a module named `EasyAuthModule_32/64`.
158160

159161
### Mitigation of cross-site request forgery
160162

161163
App Service authentication mitigates cross-site request forgery by inspecting client requests for the following conditions:
162164

163165
- It's a `POST` request that authenticated through a session cookie.
164166
- The request came from a known browser, as determined by the HTTP `User-Agent` header.
165-
- The HTTP `Origin` or HTTP `Referer` header is missing or is not in the configured list of approved external domains for redirection.
166-
- The HTTP `Origin` header is missing or is not in the configured list of cross-origin resource sharing (CORS) origins.
167+
- The HTTP `Origin` or HTTP `Referer` header is missing or isn't in the configured list of approved external domains for redirection.
168+
- The HTTP `Origin` header is missing or isn't in the configured list of cross-origin resource sharing (CORS) origins.
167169

168-
When a request fulfills all these conditions, App Service authentication automatically rejects it. You can work around this mitigation logic by adding your external domain to the redirect list in **Authentication** > **Edit authentication settings** > **Allowed external redirect URLs**.
170+
When a request fulfills all these conditions, App Service authentication automatically rejects it. You can work around this mitigation logic by adding your external domain to the redirect list in **Settings** > **Authentication** > **Edit authentication settings** > **Allowed external redirect URLs**.
169171

170172
## Considerations for using Azure Front Door
171173

@@ -177,19 +179,21 @@ Disable [Azure Front Door caching](../frontdoor/front-door-caching.md) for the a
177179

178180
### Use the Azure Front Door endpoint for redirects
179181

180-
App Service is usually not accessible directly when it's exposed via Azure Front Door. You can prevent this behavior, for example, by exposing App Service via Azure Private Link in Azure Front Door Premium. To prevent the authentication workflow from redirecting traffic back to App Service directly, it's important to configure the application to redirect back to `https://<front-door-endpoint>/.auth/login/<provider>/callback`.
182+
App Service is usually not accessible directly when it's exposed by Azure Front Door. You can prevent this behavior, for example, by exposing App Service by using Azure Private Link in Azure Front Door Premium. To prevent the authentication workflow from redirecting traffic back to App Service directly, it's important to configure the application to redirect back to `https://<front-door-endpoint>/.auth/login/<provider>/callback`.
181183

182184
### Ensure that App Service is using the right redirect URI
183185

184186
In some configurations, App Service uses its fully qualified domain name (FQDN) as the redirect URI, instead of the Azure Front Door FQDN. This configuration causes a problem when the client is redirected to App Service instead of Azure Front Door. To change it, set `forwardProxy` to `Standard` to make App Service respect the `X-Forwarded-Host` header that Azure Front Door set.
185187

186188
Other reverse proxies, like Azure Application Gateway or non-Microsoft products, might use different headers and need a different `forwardProxy` setting.
187189

188-
You can't change the `forwardProxy` configuration via the Azure portal. You need to use `az rest`.
190+
You can't change the `forwardProxy` configuration by using the Azure portal. You need to use `az rest`.
189191

190192
#### Export settings
191193

192-
`az rest --uri /subscriptions/REPLACE-ME-SUBSCRIPTIONID/resourceGroups/REPLACE-ME-RESOURCEGROUP/providers/Microsoft.Web/sites/REPLACE-ME-APPNAME/config/authsettingsV2?api-version=2020-09-01 --method get > auth.json`
194+
```bash
195+
az rest --uri /subscriptions/REPLACE-ME-SUBSCRIPTIONID/resourceGroups/REPLACE-ME-RESOURCEGROUP/providers/Microsoft.Web/sites/REPLACE-ME-APPNAME/config/authsettingsV2?api-version=2020-09-01 --method get > auth.json
196+
```
193197

194198
#### Update settings
195199

@@ -207,7 +211,9 @@ Ensure that `convention` is set to `Standard` to respect the `X-Forwarded-Host`
207211

208212
#### Import settings
209213

210-
`az rest --uri /subscriptions/REPLACE-ME-SUBSCRIPTIONID/resourceGroups/REPLACE-ME-RESOURCEGROUP/providers/Microsoft.Web/sites/REPLACE-ME-APPNAME/config/authsettingsV2?api-version=2020-09-01 --method put --body @auth.json`
214+
```bash
215+
az rest --uri /subscriptions/REPLACE-ME-SUBSCRIPTIONID/resourceGroups/REPLACE-ME-RESOURCEGROUP/providers/Microsoft.Web/sites/REPLACE-ME-APPNAME/config/authsettingsV2?api-version=2020-09-01 --method put --body @auth.json
216+
```
211217

212218
## Related content
213219

0 commit comments

Comments
 (0)