Net Core Web Api Windows Authentication Example

To create an Azure Active Directory (AD) application for your .NET Core Web API, follow these detailed steps to ensure proper configuration and functionality.

Step 1: Login to Azure Active Directory

Begin by logging into the Microsoft Azure Portal. Once logged in, navigate to the Azure Active Directory section. Ensure you have admin permissions, as these are required to register the application on the Azure portal.

Step 2: Create a New Application

From the Azure Active Directory dashboard, locate the App Registrations section in the left navigation bar. Click on it to proceed.

!Create App Registration

Next, click on New Registration. This action initiates the process of registering your application.

!New Registration

In the registration form, provide the following details:

  • Application Name: Choose a descriptive name for your application.
  • Redirect URI: Set this as a Single Page Application type.
  • Click on Register to complete this step.

!Register Application

Step 3: Configure Application Settings

After registration, you will need to configure your application settings:

  1. Sign into your Azure portal and select Azure Active Directory under Azure services.
  2. Click on App registrations in the left panel.
  3. Select your newly created application from the list.
  4. Under Supported Account Types, choose Accounts in any organizational directory (Any Azure AD directory – Multitenant). This is crucial for ensuring compatibility with Azure DevOps and Azure Active Directory, as they are treated as separate tenants.
  5. Add a redirect URI by selecting Web and entering https://YOUR_ACCESS_URL/complete/azure_active_directory, replacing YOUR_ACCESS_URL with the appropriate access URL for your region and plan.
  6. Click Register to save your settings.

Step 4: Finalize Registration

Your application should now be visible in the App registrations list. Ensure that all configurations are correct before proceeding to implement Windows authentication in your .NET Core Web API. This setup will allow your application to authenticate users effectively.

Example Configuration Table

Field Value
Name dbt Cloud
Supported account types Accounts in this organizational directory only (single tenant)

Redirect URI Configuration

Application Type Redirect URI
Single-Tenant (recommended) https://YOUR_AUTH0_URI/login/callback
Multi-Tenant https://YOUR_AUTH0_URI/login/callback

By following these steps, you will successfully create an Azure AD application tailored for your .NET Core Web API, enabling seamless integration and authentication capabilities.

Read more here: Source link