You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This article shows you how to call a protected ASP.NET Core web API using [Postman](https://www.postman.com/). Postman is an application that lets you send HTTP requests to a web API to test its authorization and access control (authentication) policies. In this article, you'll register a web app and a web API in a tenant on the Azure portal. The web app is used to get an access token generated by the Microsoft identity platform. Next, you'll use the token to make an authorized call to the web API using Postman.
21
+
This article shows you how to call a protected ASP.NET Core web API using [Postman](https://www.postman.com/). Postman is an application that lets you send HTTP requests to a web API to test its authorization and access control (authentication) policies. In this article, you'll register a web app and a web API in a tenant. The web app is used to get an access token generated by the Microsoft identity platform. Next, you'll use the token to make an authorized call to the web API using Postman.
22
22
23
23
::: zone-end
24
24
@@ -69,10 +69,10 @@ The Microsoft identity platform requires your application to be registered befor
69
69
70
70
Follow these steps to create the web API registration:
71
71
72
-
1. Sign in to the [Azure portal](https://portal.azure.com).
72
+
1. Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com) as at least an [Application Developer](../roles/permissions-reference.md#application-developer).
73
73
1. If access to multiple tenants is available, use the **Directories + subscriptions** filter :::image type="icon" source="media/common/portal-directory-subscription-filter.png" border="false"::: in the top menu to switch to the tenant in which you want to register the application.
74
-
1.Search for and select**Azure Active Directory**.
75
-
1.Under**Manage**, select **App registrations > New registration**.
74
+
1.Browse to **Identity** >**Applications** > **Application registrations**.
75
+
1.Select**New registration**.
76
76
1. Enter a **Name** for the application, such as _NewWebAPI1_.
77
77
1. For **Supported account types**, select **Accounts in this organizational directory only**. For information on different account types, select **Help me choose** option.
78
78
1. Select **Register**.
@@ -116,8 +116,8 @@ Follow these steps to create the web app registration:
116
116
117
117
::: zone pivot="no-api"
118
118
119
-
1.Select **Home** to return to the home page. Search for and select**Azure Active Directory**.
Select **Home** to return to the home page. Browse to **Identity** >**Applications** > **Application registrations**.
120
+
1.Select**New registration**.
121
121
1. Enter a **Name** for the application, such as `web-app-calls-web-api`.
122
122
1. For **Supported account types**, select **Accounts in this organizational directory only**. For information on different account types, select the **Help me choose** option.
123
123
1. Under **Redirect URI (optional)**, select **Web**, and then enter `http://localhost` in the URL text box.
@@ -127,26 +127,26 @@ Follow these steps to create the web app registration:
127
127
128
128
::: zone pivot="api"
129
129
130
-
1. Sign in to the [Azure portal](https://portal.azure.com).
131
-
1. If access to multiple tenants is available, use the Directories + subscriptions filter :::image type="icon" source="media/common/portal-directory-subscription-filter.png" border="false"::: in the top menu to switch to the tenant in which you want to register the application.
132
-
1.Search for and select**Azure Active Directory**.
1. Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com) as at least an [Application Developer](../roles/permissions-reference.md#application-developer).
131
+
1. If access to multiple tenants is available, use the **Directories + subscriptions** filter :::image type="icon" source="media/common/portal-directory-subscription-filter.png" border="false"::: in the top menu to switch to the tenant in which you want to register the application.
132
+
1.Browse to **Identity** >**Applications** > **Application registrations**.
133
+
1.Select**New registration**.
134
134
1. Enter a Name for the application, such as `web-app-calls-web-api`.
135
135
1. For **Supported account types**, select **Accounts in this organizational directory only**. For information on different account types, select the **Help me choose** option.
136
136
1. Under **Redirect URI (optional)**, select **Web**, and then enter `http://localhost` in the URL text box.
137
137
1. Select **Register**.
138
138
139
139
::: zone-end
140
140
141
-
When registration is complete, the Azure portal displays the app registration's **Overview** pane. Record the **Directory (tenant) ID** and the **Application (client) ID** to be used in later steps.
141
+
The application's **Overview** pane is displayed when registration is complete. Record the **Directory (tenant) ID** and the **Application (client) ID** to be used in later steps.
142
142
143
143
#### Add a client secret
144
144
145
145
A client secret is a string value your app can use to identity itself, and is sometimes referred to as an _application password_. The web app uses the client secret to prove its identity when it requests tokens.
146
146
147
147
Follow these steps to configure a client secret:
148
148
149
-
1. From the **Overview** pane in the Azure portal, under **Manage**, select **Certificates & secrets** > **Client secrets** > **New client secret**.
149
+
1. From the **Overview** pane, under **Manage**, select **Certificates & secrets** > **Client secrets** > **New client secret**.
150
150
1. Add a description for your client secret, for example _My client secret_.
151
151
1. Select an expiration for the secret or specify a custom lifetime.
152
152
@@ -162,14 +162,14 @@ By specifying a web API's scopes, the web app can obtain an access token contain
162
162
163
163
Follow these steps to configure client's permissions to the web API:
164
164
165
-
1. From the **Overview** pane of your application in the Azure portal, under **Manage**, select **API permissions** > **Add a permission** > **My APIs**.
165
+
1. From the **Overview** pane of your application, under **Manage**, select **API permissions** > **Add a permission** > **My APIs**.
166
166
1. Select **NewWebAPI1** or the API that you wish to add permissions to.
167
167
1. Under **Select permissions**, check the box next to **Forecast.Read**. You may need to expand the **Permission** list. This selects the permissions the client app should have on behalf of the signed-in user.
168
168
1. Select **Add permissions** to complete the process.
169
169
170
170
After adding these permissions to your API, you should see the selected permissions under **Configured permissions**.
171
171
172
-
You may also notice the **User.Read** permission for the Microsoft Graph API. This permission is added automatically when you register an app in the Azure portal.
172
+
You may also notice the **User.Read** permission for the Microsoft Graph API. This permission is added automatically when you register an app.
173
173
174
174
::: zone pivot="no-api"
175
175
@@ -183,8 +183,8 @@ You may also notice the **User.Read** permission for the Microsoft Graph API. Th
183
183
184
184
1. Navigate to `ms-identity-docs-code-dotnet/web-api` folder and open `appsettings.json`, replace the `{APPLICATION_CLIENT_ID}` and `{DIRECTORY_TENANT_ID}` with:
185
185
186
-
-`{APPLICATION_CLIENT_ID}` is the web API **Application (client) ID** on the app's **Overview** pane **App registrations** in the Azure portal.
187
-
-`{DIRECTORY_TENANT_ID}` is the web API **Directory (tenant) ID** on the app's **Overview** pane **App registrations** in the Azure portal.
186
+
-`{APPLICATION_CLIENT_ID}` is the web API **Application (client) ID** on the app's **Overview** pane **App registrations**.
187
+
-`{DIRECTORY_TENANT_ID}` is the web API **Directory (tenant) ID** on the app's **Overview** pane **App registrations**.
188
188
189
189
1. Execute the following command to start the app:
To configure an app instance lock using the Azure portal:
37
+
To configure an app instance lock:
38
38
39
-
1. Sign in to the <ahref="https://portal.azure.com/"target="_blank">Azure portal</a>.
40
-
1. If you have access to multiple tenants, use the **Directories + subscriptions** filter :::image type="icon" source="./media/common/portal-directory-subscription-filter.png" border="false"::: in the top menu to switch to the tenant that contains the app registration you want to configure.
41
-
1.Search for and select**Azure Active Directory**.
42
-
1.Under **Manage**, select **App registrations**, and then select the application you want to configure.
39
+
1. Sign in to the [Microsoft Entra admin center](https://entra.microsoft.com) as at least an [Cloud Application Administrator](../roles/permissions-reference.md#cloud-application-administrator).
40
+
1. If access to multiple tenants is available, use the **Directories + subscriptions** filter :::image type="icon" source="media/common/portal-directory-subscription-filter.png" border="false"::: in the top menu to switch to the tenant in which you want to register the application.
41
+
1.Browse to **Identity** >**Applications** > **Application registrations**.
42
+
1.Select the application you want to configure.
43
43
1. Select **Authentication**, and then select **Configure** under the *App instance property lock* section.
44
44
45
-
:::image type="content" source="media/howto-configure-app-instance-property-locks/app-instance-lock-configure-overview.png" alt-text="Screenshot of an app registration's app instance lock in the Azure portal.":::
45
+
:::image type="content" source="media/howto-configure-app-instance-property-locks/app-instance-lock-configure-overview.png" alt-text="Screenshot of an app registration's app instance lock.":::
46
46
47
47
2. In the **App instance property lock** pane, enter the settings for the lock. The table following the image describes each setting and their parameters.
48
48
49
-
:::image type="content" source="media/howto-configure-app-instance-property-locks/app-instance-lock-configure-properties.png" alt-text="Screenshot of an app registration's app instance property lock context pane in the Azure portal.":::
49
+
:::image type="content" source="media/howto-configure-app-instance-property-locks/app-instance-lock-configure-properties.png" alt-text="Screenshot of an app registration's app instance property lock context pane.":::
0 commit comments