Code Korenge
Code Korenge

Reputation: 343

Azure App Service testing with Azure AD

I have developed a simple web application and registered in azure ad (assume:@somedirectory.onmicrosoft.com). The application could be debugged locally (assume: https://localhost:50001). The reply URL (https://localhost:50001) could be redirected by AD.

Now when the same application deployed to azure app-service (basic subscription) (assume: http://somesite.azurewebsites.net), besides editing the reply URL to https://somesite.azurewebsites.net, what else is required?

This is just for demo & testing purposes.

Upvotes: 1

Views: 169

Answers (3)

Marilee Turscak - MSFT
Marilee Turscak - MSFT

Reputation: 7728

I know this is an older post, but if anyone is still having this issue, please refer to this tutorial: https://github.com/Azure-Samples/active-directory-dotnet-webapp-openidconnect

  1. Publish the application.
  2. Register the application under your tenant ("New App Registration")
  3. Add the Reply URL under the App Registration.
  4. Add the Application ID, Tenant name, and App URL to your web.config.

If you are using SSO, you also need to add the Logout URL to match the Accounts Controller. You can host your db in Azure SQL if you haven't already, and that should resolve some of your database issues.

I actually made a short video explaining this as well: https://www.youtube.com/watch?v=A9U1VGyztEM

My colleague and I also made a video about authenticating apps in Azure: https://www.youtube.com/watch?v=MohaxN6fsDs

Upvotes: 1

juvchan
juvchan

Reputation: 6255

If you assume your web app URL is: http://somesite.azurewebsites.net, I will recommend you to add both URLs (http & https) to the Reply URL:

http://somesite.azurewebsites.net

https://somesite.azurewebsites.net

This is because Azure AD application redirect URI strictly confirm to the exact URL,

i.e. if you application Redirect Uri uses http protocol and if your Reply URL is using https protocol, you will get a Reply Address mismatch error message and unable to redirect.

enter image description here

Upvotes: 1

Nan Yu
Nan Yu

Reputation: 27588

Besides editing the reply URL to https://somesite.azurewebsites.net in your code ,you also should add the reply url to Reply URLs of your azure ad application ,in Settings blade .

If you used local db in your web application . After depoly to app service , you can consider using Azure SQL or try to connect to on-premises SQL Server from a web app in Azure App Service using Hybrid Connections .

Upvotes: 1

Related Questions