question

MikaelaCaron-2451 avatar image
0 Votes"
MikaelaCaron-2451 asked ·

Azure Active Directory with Azure App Service ASP.NET

Using the Azure portal -> Azure Active Directory -> App Registrations. I created a new app registration and connected it to my Azure App Service (ASP.NET Web Forms website).

Why does the redirect URI have to always be changed from localhost/ to my azure app service URL when I develop vs when I want the changes to be live?

This makes it so anytime I'm developing the web app is down because it's trying to connect to localhost rather than the live instance of the azure app

azure-active-directoryazure-webapps
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MarileeTurscak avatar image
0 Votes"
MarileeTurscak answered ·

Hi Mikaela,

It needs to be changed so that the connection is made between Azure and your application for authentication purposes. Registering the application means that you and your developers can use Azure AD to authenticate users and request access to user resources.

If you want to test using both, you just need to add more than one reply URL in the registration and just toggle your app configuration.

https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app

https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/developer-guidance-for-integrating-applications

· 2 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MarileeTurscak ,

What do you mean by toggle the app configuration? Where is that at? I have two URLs listed in the "Web Redirect URIs" section, one is localhost and the other is the azurewebsites.net for my Azure app.

I'm also confused because within my Azure App it says that there is no authentication enabled, but it is through the "Azure Active Directory" link within the portal.

0 Votes 0 ·

By toggling I mean to change the configuration of the redirect URI in the app itself in your code configuration (generally in the app settings or web config).

Where does it say that there is no authentication enabled?

0 Votes 0 ·
ryanchill avatar image
0 Votes"
ryanchill answered ·

Hi @MikaelaCaron-2451,

@MarileeTurscak is referring to the Web Redirect URI that you mentioned. You'll have to toggle that between localhost and your deployed app or you can create a separate app registration for your localhost environment. That doesn't mean adding an app registration here will be automatically linked your app. Think of the App Registration as a registry of entries where the entry says for applications that have this GUID, the Application (client) id, send the token of an authenticated user back to this URI.

Now, from the app service standpoint, you'll use the Authentication/Authorization blade to say my app will use this app registration entry because this app has the URI that will receive the token. You can also create app registration from the app service from this blade and see it appear in the App Registration blade of the Azure Active Directory because your saying I want my app to receive the token from my tenant when a user successfully signs in.

Hope that clears up the confusion of why you can't configure app service registration from AAD in the portal. If you have any further questions, let us know.

· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @ryanchill,

It think I'm starting to understand. I have the App Registration in Azure Active Directory in the Azure portal, but I need to also go into my Azure App Service and connect it to that registration?? The authentication is already working even though I haven't done that, yet, I basically did the steps you wrote in paragraph 2, but in reverse.

0 Votes 0 ·