Skip to main content
KBY Technologies Logo

Turning On App Service Authentication With Microsoft Entra Lets Every User in the Tenant Sign In

High severityMicrosoft Azure About 20 minutes to fix

Overview

Enabling Require authentication on an App Service app does not stop other users in your Entra tenant. How to confirm it and close it safely.

At a glance

Symptom
A team puts an internal dashboard on Azure App Service.
Likely cause
Microsoft documents this directly.
Impact
The exposure is internal but real: every account in the tenant, including contractors and guests with a sign-in, can open the app, and every service principal that can…
Verification signal
Success is an unassigned account being refused while an assigned account still works.
Safe correction
Close the gap in an order that never locks out the people who need the app.
Rollback or recovery
The change affects who can sign in, so keep the way back ready before you start.

Turning on App Service authentication with the Microsoft identity provider and choosing Require authentication does not limit the app to the people you had in mind. By default the app registration it creates lets anyone in your Entra tenant in, because the feature provides authentication, not authorization. To restrict the app, require user assignment on the Entra enterprise application, assign a group first, and add a built-in authorization policy if you need one.

The change looks like a lock and behaves like a door that only checks you work at the company. The steps below confirm it, close it without locking out the intended users, and undo it.

Symptom

A team puts an internal dashboard on Azure App Service. To keep it private, someone opens the app’s Authentication blade, adds Microsoft as the identity provider, sets Restrict access to Require authentication, and leaves the default of redirecting unauthenticated requests to sign-in. A browser outside the office is now sent to the Microsoft sign-in page, and the ticket is closed.

Weeks later a colleague from another department, who was never told about the dashboard, signs in with their ordinary work account and sees the data. Nothing failed. There is no error, no 401 and no 403. The sign-in worked exactly as configured.

Why it looks safe

A sign-in page reads as a gate. The app no longer answers anonymous requests, the redirect goes to a Microsoft login, and it is natural to assume the platform also checks that the person is on a list somewhere. The portal option is called Require authentication, and the portal text for the provider says the app registration authenticates requests for your tenant. Both are true, and neither says that the app is private.

Root cause

Microsoft documents this directly. By default, App Service authentication provides only authentication, not authorization. Your application might still need to make authorization decisions in addition to any checks you configure.

For the Microsoft identity provider, the documentation says any user in your Microsoft Entra tenant can request a token for your application by default. The app registration that is created also lets anyone within the tenant access the application.

Require authentication rejects unauthenticated traffic. A request from any signed-in member of the tenant is authenticated, so it passes. The restriction you probably wanted is a separate control, either on the Entra side or in the app’s authorization policy.

Impact

The exposure is internal but real: every account in the tenant, including contractors and guests with a sign-in, can open the app, and every service principal that can obtain a token for it can call it. If the app shows payroll, customer or infrastructure data, the audit finding is that access was never restricted to a defined set of people, and no log line ever flagged it.

Because nothing errors, the gap tends to be found by accident or by a review, not by a monitoring alert.

How to confirm it

These checks only read. First export the app’s authentication settings and look at the Microsoft provider block. The command below is the export form from the App Service documentation; replace the placeholders and keep the output out of tickets, as it can include configuration references.

az rest --uri /subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Web/sites/<app-name>/config/authsettingsV2?api-version=2020-09-01 --method get > auth.json

In auth.json, check globalValidation for the unauthenticated action and look in the Microsoft provider’s validation section for a defaultAuthorizationPolicy. If the policy is absent or its allowedPrincipals.identities and allowedApplications arrays are empty, nothing in App Service narrows who may enter.

Then check the Entra side. In the Microsoft Entra admin center, open Entra ID, then Enterprise apps, select the application, choose Properties and read the setting Assignment required?. If it says No, any user in the tenant who authenticates can sign in or obtain a token for the app.

The tempting shortcut

Under pressure, people switch the app to Allow unauthenticated requests and add checks to individual pages in code, or they bury the URL and rely on nobody finding it.

The documentation does say application code is often the best place for custom authorization logic, so code checks are legitimate. As a replacement for a platform-level restriction they are weaker in practice, because any route you forget is then open to the whole tenant. That is a judgement, not documented behaviour. Hiding the URL protects nothing, since the sign-in already works for everyone.

Correction

Close the gap in an order that never locks out the people who need the app. Microsoft documents that when an application requires assignment, users and services that are not assigned cannot sign in or obtain an access token, and that user consent is then not allowed, so tenant-wide admin consent must already be granted.

  1. Record the current state: keep the auth.json export and note the app’s Properties page values.
  2. Create or choose a security group that holds exactly the intended users. Add them to it.
  3. In Enterprise apps, open the application, choose Users and groups, then Add user/group, and assign the group. Do this before the next step.
  4. Confirm that tenant-wide admin consent has been granted for the application, because requiring assignment disables user consent.
  5. Under Properties, set Assignment required? to Yes and save. You must be an owner of the enterprise application or at least a Cloud Application Administrator.
  6. If you also need to limit specific callers, such as one client application or a set of object IDs, add a defaultAuthorizationPolicy through the App Service authentication V2 API. It can only be set through an Azure Resource Manager template or the REST API, not the portal. Requests that fail these built-in checks receive HTTP 403.

Following along? Tap a step’s number to tick it off.

In the policy, allowedPrincipals.identities is a list of object IDs checked against the token’s oid claim, with a limit of 500 characters in total across the list. When both allowedApplications and allowedPrincipals are set, a request must satisfy both. For a multitenant or cross-tenant setup, the app setting WEBSITE_AUTH_AAD_ALLOWED_TENANTS accepts up to 10 tenant IDs and checks the token’s tid claim.

One boundary: the documentation notes that the assignment requirement does not apply to Global Administrators, so do not use it as the only control for something a Global Administrator must not read.

Validation

Success is an unassigned account being refused while an assigned account still works. Sign in to the app with a test account that is not in the group, in a private browser window, and confirm that you cannot sign in.

Then sign in with an account that is in the group and confirm that the app loads. Re-export authsettingsV2 and confirm that any policy you added is present. Check any service or scheduled job that calls the app with a token, because a service that was never assigned will be refused too.

Rollback

The change affects who can sign in, so keep the way back ready before you start. To undo the Entra change, set Assignment required? back to No and save; the group assignment can stay. To undo an App Service authentication policy, put the earlier export back with the import form from the same documentation page, run only after reviewing the file:

az rest --uri /subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Web/sites/<app-name>/config/authsettingsV2?api-version=2020-09-01 --method put --body @auth.json

Rolling back reopens the app to the whole tenant, so treat it as temporary, record the time and make the owner aware. If assigned users report being locked out, check that they are in the assigned group and that they are not relying on user consent before you roll back.

Prevention

Treat enabling authentication and restricting access as two changes with one checklist. Keep the authentication settings and the policy in a template or the exported JSON under source control, so a reviewer sees whether defaultAuthorizationPolicy exists.

Add a review step that reads Assignment required? for every enterprise application behind an App Service. Remember that Require authentication also applies to every path, so a public home page needs excludedPaths in the file-based configuration, which is a separate decision from who may sign in.

3

Apply the safer control

Before you change production

Confirm the affected scope, export the current configuration, and test the replacement control in a non-production environment first.

Fix commands and configuration

az rest --uri /subscriptions/<subscription-id>/resourceGroups/<resource-group>/providers/Microsoft.Web/sites/<app-name>/config/authsettingsV2?api-version=2020-09-01 --method get > auth.json
auth.json
globalValidation
4

When to escalate

Validation and rollback are covered in the sections above.

Escalate

Escalate when the blast radius is uncertain, the control cannot be tested safely, or remediation requires an outage or security exception.

The KBY Brief

Fixed? Get the next one before it hits you: The KBY Brief

Practical fixes for the systems you run, by email about twice a week. Unsubscribe at any time.

About this page

Credited to

Dates

Published

Corrections

No corrections are listed for this page. Some review sweeps corrected pages without naming each one; those are in the corrections log.

Was this useful?

Reports go to the site owner and are used to correct pages. Corrections are listed at /corrections.

Found this useful? Follow KBY for more like it.

After remediation

Further reading stays below the corrective workflow and is selected by platform, category and shared technical keywords.

More from KBY that goes with this config trap.

Discover more

Connected KBY resources