How to stop auto redirect to login.microsoft after adding identity provider?

Kid Kai 45 Reputation points
2024-01-29T18:56:26.88+00:00

I tried my first app in azure portal and added identity portal to it. The only think is when I open my website it automatically redirects to microsoft login which I dont want, I basically want that to happen when I click on sign in button in my site's login page instead of automation.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,984 questions
0 comments No comments
{count} vote

Accepted answer
  1. Grmacjon-MSFT 16,356 Reputation points
    2024-02-20T05:41:26.1266667+00:00

    @Kid Kai great response from Saravanan. I am going to expand on their answer with more details.

    To stop the automatic redirection to Microsoft login after adding an identity provider, you can adjust the settings in Azure’s Authentication / Authorization. Here are the steps you might want to consider:

    1. In the Azure portal, navigate to the Authentication / Authorization page of your application.
    2. Configure each of the identity providers you want to enable
    3. In the section Action to take when request is not authenticated, select Allow Anonymous requests (no action)
    4. In your app, add a sign-in link to each of the providers you enabled ( /.auth/login/<provider> ). This can be placed on your sign-in page, navigation bar, or any other location of your app.
    5. This way, the user will not be automatically redirected to the Microsoft login page when they open your website. Instead, they will be redirected to the login page when they click on the sign-in button.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Saravanan Ganesan 1,665 Reputation points
    2024-01-29T19:14:23.5233333+00:00

    Hi Kid , To control when Microsoft login occurs, you can implement conditional logic in your website's sign-in functionality. Avoid automatic redirection by removing the authentication-related code from your homepage or configuring conditional access policies. Implement a manual sign-in button on your login page, and use Microsoft Identity Platform SDK to trigger the authentication process only when the user clicks it. This way, the authentication will be initiated explicitly by user action, providing the desired control over the login process and preserving a seamless user experience. Regards, Saravanan Ganesan.

    0 comments No comments