Skip to content

Commit de12ab9

Browse files
committed
Corrected disable-key steps
1 parent 1681578 commit de12ab9

File tree

2 files changed

+59
-66
lines changed

2 files changed

+59
-66
lines changed

articles/search/search-howto-aad.md

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,44 +40,50 @@ In this step, configure your search service to recognize an **authorization** he
4040

4141
:::image type="content" source="media/search-create-service-portal/set-authentication-options.png" lightbox="media/search-create-service-portal/set-authentication-options.png" alt-text="Screenshot of the keys page with authentication options." border="true":::
4242

43-
1. Choose an **API access control** option.
43+
1. Choose an **API access control** option. We recommend **Both** if you want flexibility or need to migrate apps.
4444

4545
| Option | Status | Description |
4646
|--------|--------|-------------|
4747
| API Key | Generally available (default) | Requires an [admin or query API keys](search-security-api-keys.md) on the request header for authorization. No roles are used. |
48-
| Role-based access control | Preview | Requires membership in a role assignment to complete the task, described in the next step. It also requires an authorization header. Choosing this option limits you to clients that support the [2021-04-30-preview REST API](/rest/api/searchservice/index-preview). |
48+
| Role-based access control | Preview | Requires membership in a role assignment to complete the task, described in the next step. It also requires an authorization header. |
4949
| Both | Preview | Requests are valid using either an API key or role-based access control. |
5050

51+
The change is effective immediately, but wait a few seconds before testing.
52+
5153
All network calls for search service operations and content will respect the option you select: API keys, bearer token, or either one if you select **Both**.
5254

53-
When you enable role-based access control in the portal, the failure mode will be "http401WithBearerChallenge" if authorization fails. Use the Management REST API to update the service if you want to use "http403" instead.
55+
When you enable role-based access control in the portal, the failure mode will be "http401WithBearerChallenge" if authorization fails.
5456

5557
### [**REST API**](#tab/config-svc-rest)
5658

5759
Use the Management REST API version 2021-04-01-Preview, [Create or Update Service](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update), to configure your service.
5860

59-
If you're using Postman or another REST client, see [Manage Azure Cognitive Search using REST](search-manage-rest.md) for help with setting up the client.
61+
All calls to the Management REST API are authenticated through Azure Active Directory, with Contributor or Owner permissions. For help setting up authenticated requests in Postman, see [Manage Azure Cognitive Search using REST](search-manage-rest.md).
62+
63+
1. Get service settings so that you can review the current configuration.
64+
65+
```http
66+
GET https://management.azure.com/subscriptions/{{subscriptionId}}/providers/Microsoft.Search/searchServices?api-version=2021-04-01-preview
67+
```
68+
69+
1. Use PATCH to update service configuration. The following modifications enable both keys and role-based access. If you want a roles-only configuration, see [Disable API keys](search-security-rbac.md#disable-api-key-authentication).
6070

61-
1. Under "properties", set ["AuthOptions"](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update#dataplaneauthoptions) to "aadOrApiKey".
71+
Under "properties", set ["authOptions"](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update#dataplaneauthoptions) to "aadOrApiKey". The "disableLocalAuth" property must be false to set "authOptions".
6272

63-
Optionally, set ["AadAuthFailureMode"](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update#aadauthfailuremode) to specify whether 401 is returned instead of 403 when authentication fails. The default of "disableLocalAuth" is false so you don't need to set it, but it's included in the properties list to emphasize that it must be false whenever "authOptions" are set.
73+
Optionally, set ["aadAuthFailureMode"](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update#aadauthfailuremode) to specify whether 401 is returned instead of 403 when authentication fails. Valid values are "http401WithBearerChallenge" or "http403".
6474

6575
```http
66-
PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-Preview
76+
PATCH https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-Preview
6777
{
68-
"location": "{{region}}",
69-
"sku": {
70-
"name": "standard"
71-
},
72-
"properties": {
73-
"disableLocalAuth": false,
74-
"authOptions": {
75-
"aadOrApiKey": {
76-
"aadAuthFailureMode": "http401WithBearerChallenge"
77-
}
78+
"properties": {
79+
"disableLocalAuth": false,
80+
"authOptions": {
81+
"aadOrApiKey": {
82+
"aadAuthFailureMode": "http401WithBearerChallenge"
83+
}
84+
}
7885
}
79-
}
80-
}
86+
}
8187
```
8288
8389
---

articles/search/search-security-rbac.md

Lines changed: 34 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -74,46 +74,50 @@ In this step, configure your search service to recognize an **authorization** he
7474

7575
:::image type="content" source="media/search-create-service-portal/set-authentication-options.png" lightbox="media/search-create-service-portal/set-authentication-options.png" alt-text="Screenshot of the keys page with authentication options." border="true":::
7676

77-
1. Choose an **API access control** option.
77+
1. Choose an **API access control** option. We recommend **Both** if you want flexibility or need to migrate apps.
7878

7979
| Option | Status | Description |
8080
|--------|--------|-------------|
8181
| API Key | Generally available (default) | Requires an [admin or query API keys](search-security-api-keys.md) on the request header for authorization. No roles are used. |
8282
| Role-based access control | Preview | Requires membership in a role assignment to complete the task, described in the next step. It also requires an authorization header. |
8383
| Both | Preview | Requests are valid using either an API key or role-based access control. |
8484

85-
Once you make a request, it can take a few minutes for the change to take effect.
85+
The change is effective immediately, but wait a few seconds before testing.
8686

8787
All network calls for search service operations and content will respect the option you select: API keys, bearer token, or either one if you select **Both**.
8888

89-
When you enable role-based access control in the portal, the failure mode will be "http401WithBearerChallenge" if authorization fails. Use the Management REST API to update the service if you want to use "http403" instead.
89+
When you enable role-based access control in the portal, the failure mode will be "http401WithBearerChallenge" if authorization fails.
9090

9191
### [**REST API**](#tab/config-svc-rest)
9292

9393
Use the Management REST API version 2021-04-01-Preview, [Create or Update Service](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update), to configure your service.
9494

9595
All calls to the Management REST API are authenticated through Azure Active Directory, with Contributor or Owner permissions. For help setting up authenticated requests in Postman, see [Manage Azure Cognitive Search using REST](search-manage-rest.md).
9696

97-
1. Under "properties", set ["authOptions"](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update#dataplaneauthoptions) to "aadOrApiKey".
97+
1. Get service settings so that you can review the current configuration.
9898

99-
Optionally, set ["aadAuthFailureMode"](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update#aadauthfailuremode) to specify whether 401 is returned instead of 403 when authentication fails. The default of "disableLocalAuth" is false so you don't need to set it, but it's included in the properties list to emphasize that it must be false whenever "authOptions" are set.
99+
```http
100+
GET https://management.azure.com/subscriptions/{{subscriptionId}}/providers/Microsoft.Search/searchServices?api-version=2021-04-01-preview
101+
```
102+
103+
1. Use PATCH to update service configuration. The following modifications enable both keys and role-based access. If you want a roles-only configuration, see [Disable API keys](#disable-api-key-authentication).
104+
105+
Under "properties", set ["authOptions"](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update#dataplaneauthoptions) to "aadOrApiKey". The "disableLocalAuth" property must be false to set "authOptions".
106+
107+
Optionally, set ["aadAuthFailureMode"](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update#aadauthfailuremode) to specify whether 401 is returned instead of 403 when authentication fails. Valid values are "http401WithBearerChallenge" or "http403".
100108

101109
```http
102-
PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-Preview
110+
PATCH https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-Preview
103111
{
104-
"location": "{{region}}",
105-
"sku": {
106-
"name": "standard"
107-
},
108-
"properties": {
109-
"disableLocalAuth": false,
110-
"authOptions": {
111-
"aadOrApiKey": {
112-
"aadAuthFailureMode": "http401WithBearerChallenge"
113-
}
112+
"properties": {
113+
"disableLocalAuth": false,
114+
"authOptions": {
115+
"aadOrApiKey": {
116+
"aadAuthFailureMode": "http401WithBearerChallenge"
117+
}
118+
}
114119
}
115-
}
116-
}
120+
}
117121
```
118122
119123
1. Follow the instructions in the next step to assign roles for data plane operations.
@@ -489,47 +493,30 @@ To disable [key-based authentication](search-security-api-keys.md), use Azure po
489493

490494
1. Select **Role-based access control**.
491495

492-
The change is effective immediately. Assuming you have permission to assign roles as a member of Owner, service administrator, or co-administrator, you can use portal features to test role-based access.
496+
The change is effective immediately, but wait a few seconds before testing. Assuming you have permission to assign roles as a member of Owner, service administrator, or co-administrator, you can use portal features to test role-based access.
493497

494498
### [**REST API**](#tab/disable-keys-rest)
495499

496-
Use Postman or another REST client to send two consecutive requests for [Update Service](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update). See [Manage a search service using REST APIs](search-manage-rest.md) for instructions on setting up the client.
500+
To disable key-based authentication, set "disableLocalAuth" to true.
497501

498-
1. On the first request, set ["authOptions"](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update#dataplaneauthoptions) to "aadOrApiKey" to enable Azure AD authentication. Activating Azure AD authentication is a prerequisite to setting "disableLocalAuth".
502+
1. Get service settings so that you can review the current configuration.
499503

500-
```http
501-
PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-Preview
502-
{
503-
"location": "{{region}}",
504-
"sku": {
505-
"name": "standard"
506-
},
507-
"properties": {
508-
"authOptions": {
509-
"aadOrApiKey": {
510-
"aadAuthFailureMode": "http401WithBearerChallenge"
511-
}
512-
}
513-
}
514-
}
515-
```
504+
```http
505+
GET https://management.azure.com/subscriptions/{{subscriptionId}}/providers/Microsoft.Search/searchServices?api-version=2021-04-01-preview
506+
```
516507

517-
1. On the second request, set ["disableLocalAuth"](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update#request-body) to true. This step turns off the API key portion of the "aadOrApiKey" option, leaving you with just Azure AD authentication.
508+
1. Use PATCH to update service configuration. The following modification will set "authOptions" to null.
518509

519510
```http
520-
PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-Preview
511+
PATCH https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-Preview
521512
{
522-
"location": "{{region}}",
523-
"sku": {
524-
"name": "standard"
525-
},
526-
"properties": {
527-
"disableLocalAuth": true
528-
}
513+
"properties": {
514+
"disableLocalAuth": true
515+
}
529516
}
530517
```
531518
532-
You can't combine steps one and two. In step one, "disableLocalAuth" must be false to meet the requirements for setting "authOptions", whereas step two changes that value to true.
519+
Requests that include an API key only, with no bearer token, will fail with an HTTP 401.
533520
534521
To re-enable key authentication, rerun the last request, setting "disableLocalAuth" to false. The search service will resume acceptance of API keys on the request automatically (assuming they're specified).
535522

0 commit comments

Comments
 (0)