bmanstey, Following-up from my comments.
Scenario:
Developed a Blazor Server application that integrates Azure Authentication/Azure AD/Microsoft Entra. The app works seamlessly on localhost during testing, using a localhost certificate. However, issues arise when deploying the application to IIS on a web server, specifically related to the Azure authentication process.
Issue:
When the application is deployed to IIS with a certificate created from the domain controller and uploaded to Azure AD (with the thumbprint updated in the appsettings
file), the app fails to sign users in. Azure logs show successful authentication, but users encounter a "We couldn't sign you in" message. The browser appears to loop during the login process.
Issue was resolved by @bmanstey (Thank you). Copied the answer/solution that worked.
There were 2 issues that needed to be addressed to resolve this problem:
- When deploying to the IIS web server the certificate being used was a machine cert not a user cert so in the appsettings "CertificateStorePath": "CurrentUser/My" needed to be replaced with "CertificateStorePath": "LocalMachine/My".
- The account running the IIS application pool for the site needs to be granted access to the certificate used. The process for which can be found in this article. Providing IIS Application Pool Identity read access to a certificate in the Local Computer Personal Certificate Store
- Note: This post contains URL to third party site (above) not monitored by Microsoft. Exercise caution while navigating within the site.
Please click Accept Answer to benefit the community find answers quickly to similar question.