By default, Azure Static Web Apps always uses the common
endpoint unless you explicitly override it with a tenant-specific openIdIssuer
. common
means any Microsoft account (work, school, personal) can attempt login. That’s why personal accounts are still being accepted.
How to force tenant-specific login (MyCompany only)
Update your staticwebapp.config.json
so that openIdIssuer
points directly to your tenant ID, not common
.
Example:
{
"auth": {
"identityProviders": {
"azureActiveDirectory": {
"registration": {
"openIdIssuer": "https://login.microsoftonline.com/<your-tenant-id>/v2.0"
}
}
}
}
}
Replace <your-tenant-id>
with either:
- Your GUID tenant ID (preferred), or
- Your verified domain (
mycompany.com
)
To stop personal accounts-
If you use the tenant-specific issuer (https://login.microsoftonline.com/<tenant-id>/v2.0
), personal Microsoft accounts won’t even be able to sign in.
If you keep /common
, you’d have to rely on app-level policies or conditional access to block them, but tenant-specific issuer is cleaner.
Still see “admin consent required” sometimes. That usually means:
The Entra app registration didn’t have permissions granted at tenant level. (Re-check API permissions → Grant admin consent).
Or, you were still authenticating against common
instead of your tenant (so consent wasn’t recognized properly).
Switching to a tenant-specific openIdIssuer
fixes this.
steps-
- Change your
staticwebapp.config.json
to use tenant-specificopenIdIssuer
. - Redeploy the Static Web App.
- Test login — you should only see the MyCompany login page, no personal accounts.
https://learn.microsoft.com/en-us/azure/static-web-apps/authentication-authorization