Is it possible to use Entra authentication for Azure VM hosted .NET website?

CloudFirst 20 Reputation points
2025-04-30T05:27:45.1633333+00:00

Is it possible to use Entra authentication for Azure VM hosted .NET website? I don't want the app service deployment due to some dependency.

I'd 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.

Is this the correct way to use Azure Entra authentication for IaaS hosted website or is it not allowed?

Any help would be greatly appreciated.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
24,655 questions
{count} votes

Accepted answer
  1. Harshitha Eligeti 4,055 Reputation points Microsoft External Staff Moderator
    2025-05-02T14:12:27.1466667+00:00

    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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.