Reputation: 61
I am trying to setup in a way where I only want my internal azure AD users be able to see the pages deployed for Azure static web app. The app works fine when I just use default aad (i.e. can login from any azure AD user) and users are getting redirected to Login for Azure AD.
The issue is when I add azure ad auth for my tenant to my staticwebapp.config.json as per doc (https://learn.microsoft.com/en-us/azure/static-web-apps/authentication-custom?tabs=aad) the authentication is not working and users are not getting redirected to Azure AD for authentication instead users stays on same site and showing 404 for /.auth/login/aad page. I am not able to figure out why its redirecting fine without the auth section in the config.json file and not with the auth section for custom Azure Ad authentication.
"auth": {
"identityProviders": {
"azureActiveDirectory": {
"registration": {
"openIdIssuer": "https://login.microsoftonline.com/<TENANT_ID>/v2.0",
"clientIdSettingName": "AAD_CLIENT_ID",
"clientSecretSettingName": "AAD_CLIENT_SECRET"
}
}
}
}
Upvotes: 2
Views: 1422
Reputation: 1808
Error: when you trying to navigate to web app getting error (404)
Add the AADClientID
and AADSecret
to the web app configuration.
1) Go to your Static Web App, click on Configuration and choose + Add:
2) Add the two entries, one with the name AADSecret
and AADClientID
with the client ID
3) click on the Save, you will be prompted for authentication and the first time you authenticate the app you will get a Permissions requested dialog since we are allowing the app to sign in and read profile information.
For more details refer this document
Upvotes: 2