Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
331 stars 57 forks source link

AAD - Limiting access only to AD users in tenant? #1210

Open bdm123 opened 1 year ago

bdm123 commented 1 year ago

Hi,

I have AAD authentication setup, which I expected to only allow active accounts in AD to sign in. I just realized that I am able to sign in and view authenticated content with my personal microsoft account, which is not a member of the AD tenant. How do I simply allow only active AD accounts in X-X-X-X tenant to access the content? Below are the config settings

"routes": [ { "route": "/*", "allowedRoles": [ "authenticated" ] } ], "auth": { "identityProviders": { "azureActiveDirectory": { "registration": { "openIdIssuer": "https://login.microsoftonline.com/X-X-X-X/v2.0", "clientIdSettingName": "AZURE_CLIENT_ID", "clientSecretSettingName": "AZURE_CLIENT_SECRET" } } } }

Thanks in advance.

mishapos commented 1 year ago

Hello, thank you for using Azure Static Web Apps.

To restrict access to accounts only in your Tenant, can you please try going to the "Authentication" tab of your Azure Active Directory App Registration and, under "Supported account types", select "Accounts in this organizational directory only ( Single tenant)". And let us know if that gives you the behavior you are looking for. Thank you.