Hello @CloudFirst
I Understand that you have configured the APP registration, AD User, redirect URI (VM's DNSname) and used UseOpenIdConnectAuthentication in the .NET code for authentication; while opening the website URL it asks for authentication after the authentication website shows failed with 502 and not hitting the redirectURI.
Yes, it is possible to use Microsoft Entra authentication for a .NET website hosted on an Azure VM. You can configure your application to use OpenID Connect for authentication, as you have already done by setting up the app registration and using UseOpenIdConnectAuthentication
in your .NET code.
The 502 error you're encountering may be due to a misconfiguration of the redirect URI or issues with the networking setup of your Azure VM. Ensure that the redirect URI is correctly set to the VM’s DNS name, and that HTTPS (usually port 443) is open and accessible. Verify that your application is properly registered in Entra ID, with the correct client ID and client secret, and that the necessary Azure AD users and permissions are configured appropriately.
Using Azure Entra authentication for an IaaS-hosted website is allowed, but you need to ensure that all configurations are correct, and the application is properly set up to handle the authentication flow.
For additional information please refer this document: https://learn.microsoft.com/en-us/azure/azure-government/documentation-government-aad-auth-qs#integrate-microsoft-entra-login-into-a-web-application-using-openid-connect
Do Let us know if you have any queries. We are happy to assist further.