Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Prepare applications for Azure deployment by generating infrastructure code, Dockerfiles, and config files.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/services/app-service/templates/recipes/auth/README.md
1# Entra ID / Easy Auth Recipe โ REFERENCE ONLY23Adds authentication and authorization to an App Service base template using Microsoft Entra ID.45## Overview67This recipe configures authentication for App Service apps using either Easy Auth (built-in authentication) or MSAL SDK-based authentication. Easy Auth requires zero code changes; MSAL gives full control.89## Integration Type1011| Aspect | Value |12|--------|-------|13| **Provider** | Microsoft Entra ID (Azure AD) |14| **Method** | Easy Auth (built-in) or MSAL SDK |15| **Protocols** | OpenID Connect, OAuth 2.0 |16| **Token validation** | Automatic (Easy Auth) or middleware (MSAL) |1718## Option A: Easy Auth (Recommended for most apps)1920Zero-code authentication built into App Service. Handles login, token management, and session cookies.2122### Bicep Configuration2324> ๐ก Call `mcp_bicep_get_az_resource_type_schema` with resource type `Microsoft.Web/sites/config` to validate properties before generating this resource.2526```bicep27resource authSettings 'Microsoft.Web/sites/config@2023-12-01' = {28parent: webApp29name: 'authsettingsV2'30properties: {31globalValidation: {32requireAuthentication: true33unauthenticatedClientAction: 'RedirectToLoginPage'34}35identityProviders: {36azureActiveDirectory: {37enabled: true38registration: {39openIdIssuer: 'https://login.microsoftonline.com/${tenant().tenantId}/v2.0'40clientId: appRegistration.properties.appId41}42validation: {43defaultAuthorizationPolicy: {44allowedApplications: []45}46}47}48}49login: {50tokenStore: {51enabled: true52}53}54}55}56```5758### App Registration5960> ๐ก Call `mcp_bicep_get_az_resource_type_schema` with resource type `Microsoft.Graph/applications` to validate properties before generating this resource. The `microsoftGraphV1_0` extension is required โ declare it at the top of the Bicep file.6162```bicep63extension microsoftGraphV1_06465resource appRegistration 'Microsoft.Graph/[email protected]' = {66displayName: '${name}-app'67web: {68redirectUris: [69'https://${webApp.properties.defaultHostName}/.auth/login/aad/callback'70]71}72}73```7475## Option B: MSAL SDK (Full control)7677Use when you need custom token validation, API-only auth, or multi-tenant support.7879| Language | Source File |80|----------|-------------|81| C# (ASP.NET Core) | [source/dotnet.md](source/dotnet.md) |82| Python (FastAPI) | [source/python.md](source/python.md) |83| Node.js (Express) | [source/nodejs.md](source/nodejs.md) |8485## App Settings8687| Setting | Value | Purpose |88|---------|-------|---------|89| `AZURE_TENANT_ID` | Entra tenant ID | Identity provider |90| `AZURE_CLIENT_ID` | App registration client ID | Application identity |9192## References9394- [Easy Auth overview](https://learn.microsoft.com/en-us/azure/app-service/overview-authentication-authorization)95- [Microsoft Identity Web](https://learn.microsoft.com/en-us/entra/msal/dotnet/microsoft-identity-web/)96- [Configure Entra ID auth](https://learn.microsoft.com/en-us/azure/app-service/configure-authentication-provider-aad)97