Description
Protect sign-in-only routes such as admin pages or internal APIs with platform authentication or the app’s own authentication. Identify routes intended to be public.
Potential impact
Anonymous requests can expose protected data or administrative actions. Signed-in users can also exceed their role if the app skips authorization.
Remediation
For platform authentication, configure an identity provider and reject anonymous requests to protected paths or send them to sign-in. Apply HTTPS and any required network restrictions, then test access as an anonymous caller, a signed-in user without permission, and an authorized user.
Examples
Declare or reference the parent Web App in your Bicep template using the resource symbol webApp1. The examples enable platform authentication by changing enabled from false to true in its authsettings. Configure the provider, anonymous-request handling and application permissions to enforce the intended access policy.
Before
resource webApp1_authsettings 'Microsoft.Web/sites/config@2020-12-01' = {
parent: webApp1
name: 'authsettings'
properties: {
enabled: false
}
}
After
resource webApp1_authsettings 'Microsoft.Web/sites/config@2020-12-01' = {
parent: webApp1
name: 'authsettings'
properties: {
enabled: true
}
}