Skip to content

Commit e7d1fd9

Browse files
Merge pull request #234786 from jmprieur/jmprieur/aspnetApiQsUpdate
Update the ASP.NET web API quickstart
2 parents 35d5296 + 8373946 commit e7d1fd9

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

articles/active-directory/develop/includes/web-api/quickstart-dotnet-native-aspnet.md

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.service: active-directory
88
ms.subservice: develop
99
ms.topic: include
1010
ms.workload: identity
11-
ms.date: 12/09/2022
11+
ms.date: 04/17/2023
1212
ms.author: cwerner
1313
ms.reviewer: jmprieur
1414
ms.custom: devx-track-csharp, aaddev, identityplatformtop40, "scenarios:getting-started", "languages:ASP.NET", mode-api, engagement-fy23
@@ -49,7 +49,7 @@ Register your web API in **App registrations** in the Azure portal.
4949
1. Enter a **Name** for your application, for example `AppModelv2-NativeClient-DotNet-TodoListService`. Users of your app might see this name, and you can change it later.
5050
1. For **Supported account types**, select **Accounts in any organizational directory**.
5151
1. Select **Register** to create the application.
52-
1. On the app **Overview** page, look for the **Application (client) ID** value, and then record it for later use. You'll need it to configure the Visual Studio configuration file for this project (that is, `ClientId` in the *TodoListService\Web.config* file).
52+
1. On the app **Overview** page, look for the **Application (client) ID** value, and then record it for later use. You'll need it to configure the Visual Studio configuration file for this project (that is, `ClientId` in the *TodoListService\appsettings.json* file).
5353
1. Under **Manage**, select **Expose an API** > **Add a scope**. Accept the proposed Application ID URI (`api://{clientId}`) by selecting **Save and continue**, and then enter the following information:
5454

5555
1. For **Scope name**, enter `access_as_user`.
@@ -65,9 +65,9 @@ Register your web API in **App registrations** in the Azure portal.
6565

6666
Configure the service project to match the registered web API.
6767

68-
1. Open the solution in Visual Studio, and then open the *Web.config* file under the root of the TodoListService project.
68+
1. Open the solution in Visual Studio, and then open the *appsettings.json* file under the root of the TodoListService project.
6969

70-
1. Replace the value of the `ida:ClientId` parameter with the Client ID (Application ID) value from the application you registered in the **App registrations** portal.
70+
1. Replace the value of the `Enter_the_Application_Id_here` by the Client ID (Application ID) value from the application you registered in the **App registrations** portal both in the `ClientID` and the `Audience` properties.
7171

7272
### Add the new scope to the app.config file
7373

@@ -167,18 +167,7 @@ You can allow users from other directories to access your web API by pre-authori
167167

168168
By default, any personal accounts, such as *outlook.com* or *live.com* accounts, or work or school accounts from organizations that are integrated with Azure AD can request tokens and access your web API.
169169

170-
To specify who can sign in to your application, use one of the following options:
171-
172-
### Option 1: Limit access to a single organization (single tenant)
173-
174-
You can limit sign-in access to your application to user accounts that are in a single Azure AD tenant, including guest accounts of that tenant. This scenario is common for line-of-business applications.
175-
176-
1. Open the *App_Start\Startup.Auth* file, and then change the value of the metadata endpoint that's passed into the `OpenIdConnectSecurityTokenProvider` to `https://login.microsoftonline.com/{Tenant ID}/v2.0/.well-known/openid-configuration`. You can also use the tenant name, such as `contoso.onmicrosoft.com`.
177-
1. In the same file, set the `ValidIssuer` property on the `TokenValidationParameters` to `https://sts.windows.net/{Tenant ID}/`, and set the `ValidateIssuer` argument to `true`.
178-
179-
### Option 2: Use a custom method to validate issuers
180-
181-
You can implement a custom method to validate issuers by using the `IssuerValidator` parameter. For more information about this parameter, see [TokenValidationParameters class](/dotnet/api/microsoft.identitymodel.tokens.tokenvalidationparameters).
170+
To specify who can sign in to your application, by changing the `TenantId` property in the *appsettings.json* file.
182171

183172
[!INCLUDE [Help and support](../../../../../includes/active-directory-develop-help-support-include.md)]
184173

0 commit comments

Comments
 (0)