Lesson 1 of 5 Securing Application Platform Services

Securing Azure App Service

This lesson covers transport settings, authentication, network access and secrets for App Service.

Learning outcomes

After completing this lesson, you will be able to:

  • Identify baseline settings.
  • Describe Easy Auth.
  • Distinguish access restrictions, private endpoints and virtual network integration.
  • Explain Key Vault references.

Shared responsibility on App Service

Azure App Service hosts web applications and APIs, and Microsoft manages the operating system and runtime patches. The customer remains responsible for application code, its configuration, access, and how the app is exposed. Some settings are not secure by default, so an engineer should check each one. Every app gets a public hostname by default, at APP.azurewebsites.net, and that address is reachable from the internet until it is restricted.

Transport and deployment settings

Several settings should be applied to every app.

  • HTTPS Only: redirects HTTP to HTTPS. It is not on by default.
  • Minimum TLS version: the default is TLS 1.2, and TLS 1.3 is supported. Set it for both the app and the SCM site.
  • Basic authentication: disable it for FTP and SCM, so that deployments use Microsoft Entra identities.
  • FTP state: set it to Disabled, or FTPS only.
  • Remote debugging: keep it off in production.
  • Client certificates: enable them when mutual TLS is required.

The SCM site, or Kudu, at APP.scm.azurewebsites.net, is a management endpoint for deployment and diagnostics. It can have separate access restrictions, and it deserves at least the same protection as the app.

True or false

App Service defaults

Exam skills 3.3.7

Check the App Service transport and deployment settings.

Log in to try this activity Interactive activities are free with an account.

Authentication with Easy Auth

App Service authentication, known as Easy Auth, adds sign-in with no code change. A platform module intercepts requests before they reach the app, and handles Microsoft Entra ID, Microsoft accounts, Google, Facebook and X. It can redirect unauthenticated users to sign in, or return HTTP 401 for an API.

It is a strong option for an app with no built-in authentication. For a more detailed authorization need, the app can read claims from the headers that the platform injects. Combine this with a Conditional Access policy that targets the app's registration, so that MFA or a compliant device can be demanded.

The following diagram shows the platform module in front of the app.

App Service authentication, known as Easy Auth. A platform module intercepts each request before it reaches the app. An unauthenticated request is redirected to sign in, or receives HTTP 401 for an API. An authenticated request reaches the app with identity claims in headers that the platform injects. A Conditional Access policy on the app's registration can require MFA or a compliant device.
Sign-in is handled before the request reaches your code.

Network access

Inbound and outbound network controls are separate features, and exam questions often test whether a candidate can tell them apart.

Access restrictions
DirectionInbound
FunctionFilters public traffic by IP, service tag or subnet
Public endpointStays on, with filtering
Choose when Allow only known sources
Private endpoint
DirectionInbound
FunctionGives the app a private address
Public endpointCan be disabled
Choose when Private inbound access
Virtual network integration
DirectionOutbound
FunctionLets the app reach private resources
Public endpointUnaffected
Choose when Reach a private database

An app can use a private endpoint and virtual network integration together, to be fully private in both directions. A service tag in an access restriction can limit traffic to Azure Front Door, for instance with AzureFrontDoor.Backend, and an HTTP header check on the Front Door ID makes sure that the traffic comes from your own profile. App Service Environment is a dedicated, single-tenant deployment in your virtual network, which provides the strongest isolation.

Sort into groups

Inbound or outbound control?

Exam skills 3.3.7

Choose the App Service network feature for each requirement.

Log in to try this activity Interactive activities are free with an account.

Secrets and identity

An app should not hold credentials in its settings. Use a managed identity to reach resources, and Key Vault references in application settings where a secret is unavoidable. A reference has this form: @Microsoft.KeyVault(SecretUri=https://VAULT.vault.azure.net/secrets/NAME/). The app's identity needs Key Vault Secrets User. App settings are encrypted at rest, but anyone with sufficient rights can view them, so a reference limits that exposure. If the vault is behind a firewall, the app must reach it through virtual network integration.

Defender for App Service is the workload protection plan, which uses the platform's view of requests to detect attacks such as scanning, and dangling DNS. A dangling DNS record is one that points to a deleted app, which an attacker could reclaim in order to take over the subdomain.

Scenario questions

App secrets and threats

Exam skills 3.3.7

Apply App Service secret handling and threat protection.

Log in to try this activity Interactive activities are free with an account.
Worked example

Locking an app to Front Door

An App Service app sits behind Azure Front Door with a WAF. Testers have found that the app can be reached directly at its azurewebsites.net address, which bypasses the WAF. The app must reach an Azure SQL database that has public access disabled. What should you configure?

Add an access restriction with the AzureFrontDoor.Backend service tag, along with a header check on X-Azure-FDID, so that only your profile can reach the app. Alternatively, use Front Door Premium with Private Link to the app, and disable public access. For the database, use virtual network integration with a private endpoint on the database.

The service tag alone would admit other customers' Front Door profiles. A private endpoint on the app is an inbound feature, so it would not help the app to reach the database.

Check yourself

Does virtual network integration make an app private to inbound callers?

Show answer

No. It is for outbound traffic. A private endpoint gives private inbound access.

Exam Tips

Remember for the exam

  • HTTPS Only is not on by default.
  • Private endpoint is inbound; virtual network integration is outbound.
  • A Front Door service tag needs a header check to limit it to your profile.
  • Use Key Vault references rather than secrets in app settings.