Home > Enterprise >  What need to be done on Azure to allow our ASP.NET Core 6.0 MVC to authenticate the users against Az
What need to be done on Azure to allow our ASP.NET Core 6.0 MVC to authenticate the users against Az

Time:02-03

I created a new ASP.NET Core MVC 6.0 web application >> and i define it to use Azure AD for authentication, as follow:-

enter image description here

enter image description here

then i were asked to create owned application, so i created one named "ad" as follow:-

enter image description here

enter image description here

and inside my application's appsetting i got these settings:-

{
  "AzureAd": {
    "Instance": "https://login.microsoftonline.com/",
    "Domain": "*****",
    "TenantId": "***",
    "ClientId": "***",
    "CallbackPath": "/signin-oidc"
  },

so seems visual studio did all the work for us. now we want to deploy our application to our client office 365 tenant, so what need to be done on Azure to allow our application to connect to our client Azure AD instead of our Azure AD which was set using visual studio?

second question, now when i accessed All resources inside our Azure portal, i could not find the application named "ad" which was created inside visual studio 2022, so what is the reason?

enter image description here

Thanks

CodePudding user response:

so what need to be done on Azure to allow our application to connect to our client Azure AD...

No need to change anything in Azure Portal, when you create resource in Visual Studio, I trust you are asked to sign in first. If you signed in with the account that you used to sign in Azure portal, then the resources will appear in Azure Portal.

i could not find the application named "ad"

That's because you created Azure AD application which is not a service in Azure subscription. You can going to Azure portal --> choose the correct tenant if you had several tenants --> go to Azure Active Directory -->app registration --> owned applications, then you can see your ad application.

enter image description here enter image description here

CodePudding user response:

I tried to reproduce the same in my environment and got the results successfully as below:

I Registered an ASP.NET Core MVC 6.0 web application:

enter image description here

enter image description here

The ad Application got created successfully like below:

enter image description here

And configured the Additional settings as below:

enter image description here

The appsettings.json file looks like below:

enter image description here

Note that: The created Azure AD Application will be reflected in the Azure Portal in Azure Active Directory -> App registrations -> All Applications

enter image description here

After executing the application, I signed in and got the screen as below:

enter image description here

I logged in to the Azure AD Application successfully like below:

enter image description here

Now we want to deploy our application to our client office 365 tenant, so what need to be done on Azure to allow our application to connect to our client Azure AD instead of our Azure AD which was set using visual studio?

I created an Azure AD Application in another tenant as below:

enter image description here

Now, you can change the appsettings.json file by updating the above application details like below:

{
  "AzureAd": {
    "Instance": "https://login.microsoftonline.com/",
    "Domain": "xxx.onmicrosoft.com",
    "TenantId": "***",
    "ClientId": "***",
    "CallbackPath": "/signin-oidc"
  },

enter image description here

And executing the application and I signed in with the tenant user like below:

enter image description here

I logged in to the Azure AD Application successfully like below:

enter image description here

  • Related