Skip to content

Commit 1f98cd7

Browse files
authored
Merge pull request #225144 from HeidiSteen/heidist-rbac
[azure search] RBAC doc fixes (removed preview sign up)
2 parents 70963c2 + 942ae2d commit 1f98cd7

File tree

4 files changed

+130
-146
lines changed

4 files changed

+130
-146
lines changed

articles/search/search-api-preview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Preview features that transition to general availability are removed from this l
2323
|Feature                         | Category | Description | Availability |
2424
|---------|------------------|-------------|---------------|
2525
| [**Azure Files indexer**](search-file-storage-integration.md) | Indexer data source | Adds REST API support for creating indexers for [Azure Files](https://azure.microsoft.com/services/storage/files/) | Public preview, [Search REST API 2021-04-30-Preview](/rest/api/searchservice/index-preview). Announced in November 2021. |
26-
| [**Azure RBAC support (data plane)**](search-security-rbac.md) | Security | Use new built-in roles to control access to indexes and indexing, eliminating or reducing the dependency on API keys. | Public preview ([registration required](./search-security-rbac.md?tabs=config-svc-portal%2croles-portal%2ctest-portal#step-1-preview-sign-up)). After you're registered, use the Azure portal or the Management REST API version 2021-04-01-Preview to configure a search service for data plane authentication. Announced in July 2021. |
26+
| [**Azure RBAC support (data plane)**](search-security-rbac.md) | Security | Use new built-in roles to control access to indexes and indexing, eliminating or reducing the dependency on API keys. | Public preview. Use the Azure portal or the Management REST API version 2021-04-01-Preview to configure a search service for data plane authentication. Announced in July 2021. |
2727
| [**Search REST API 2021-04-30-Preview**](/rest/api/searchservice/index-preview) | Security | Modifies [Create or Update Data Source](/rest/api/searchservice/preview-api/create-or-update-data-source) to support managed identities under Azure Active Directory, for indexers that connect to external data sources. | Public preview, [Search REST API 2021-04-30-Preview](/rest/api/searchservice/index-preview). Announced in May 2021. |
2828
| [**Management REST API 2021-04-01-Preview**](/rest/api/searchmanagement/) | Security | Modifies [Create or Update Service](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update) to support new [DataPlaneAuthOptions](/rest/api/searchmanagement/2021-04-01-preview/services/create-or-update#dataplaneauthoptions). | Public preview, [Management REST API](/rest/api/searchmanagement/), API version 2021-04-01-Preview. Announced in May 2021. |
2929
| [**Reset Documents**](search-howto-run-reset-indexers.md) | Indexer | Reprocesses individually selected search documents in indexer workloads. | Use the [Reset Documents REST API](/rest/api/searchservice/preview-api/reset-documents), API versions 2021-04-30-Preview or 2020-06-30-Preview. |

articles/search/search-howto-aad.md

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,40 +26,67 @@ This article shows you how to configure your client for Azure AD:
2626

2727
+ Update your client code to call [DefaultAzureCredential()](/dotnet/api/azure.identity.defaultazurecredential)
2828

29-
## Prepare your search service
29+
## Configure role-based access for data plane
3030

31-
As a first step, sign up for the preview and enable role-based access control (RBAC) on your [search service](search-create-service-portal.md).
31+
**Applies to:** Search Index Data Contributor, Search Index Data Reader, Search Service Contributor
3232

33-
### Sign up for the preview
33+
In this step, configure your search service to recognize an **authorization** header on data requests that provide an OAuth2 access token.
3434

35-
RBAC for data plane operations is in preview. In this step, add the preview feature to your Azure subscription.
35+
### [**Azure portal**](#tab/config-svc-portal)
3636

37-
1. Open [Azure portal](https://portal.azure.com/) and find your search service
37+
1. [Sign in to Azure portal](https://portal.azure.com) and open the search service page.
3838

39-
1. On the left-nav pane, select **Keys**.
39+
1. Select **Keys** in the left navigation pane.
4040

41-
1. In the blue banner that mentions the preview, select **Register** to add the feature to your subscription.
41+
:::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-
:::image type="content" source="media/search-howto-aad/rbac-signup-portal.png" alt-text="Screenshot of how to sign up for the rbac preview in the portal" border="true" :::
43+
1. Choose an **API access control** option. We recommend **Both** if you want flexibility or need to migrate apps.
4444

45-
You can also sign up for the preview using Azure Feature Exposure Control (AFEC) and searching for *Role Based Access Control for Search Service (Preview)*. For more information on adding preview features, see [Set up preview features in Azure subscription](../azure-resource-manager/management/preview-features.md?tabs=azure-portal).
45+
| Option | Status | Description |
46+
|--------|--------|-------------|
47+
| 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. |
49+
| Both | Preview | Requests are valid using either an API key or role-based access control. |
4650

47-
> [!NOTE]
48-
> Once you add the preview to your subscription, all search services in the subscription are permanently enrolled in the preview. If you don't want RBAC on a given service, you can disable RBAC for data plane operations as shown in a later step.
51+
The change is effective immediately, but wait a few seconds before testing.
52+
53+
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**.
54+
55+
When you enable role-based access control in the portal, the failure mode will be "http401WithBearerChallenge" if authorization fails.
56+
57+
### [**REST API**](#tab/config-svc-rest)
58+
59+
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.
4960

50-
### Enable RBAC for data plane operations
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).
5162

52-
Once your subscription is added to the preview, you'll still need to enable RBAC for data plane operations so that you can use Azure AD authentication. By default, Azure Cognitive Search uses key-based authentication for data plane operations but you can change the setting to allow role-based access control.
63+
1. Get service settings so that you can review the current configuration.
5364

54-
1. Navigate to your search service in the [Azure portal](https://portal.azure.com/).
65+
```http
66+
GET https://management.azure.com/subscriptions/{{subscriptionId}}/providers/Microsoft.Search/searchServices?api-version=2021-04-01-preview
67+
```
5568

56-
1. On the left navigation pane, select **Keys**.
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).
5770

58-
1. Choose whether to allow both key-based and role-based access control, or only role-based access control.
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".
5972

60-
:::image type="content" source="media/search-howto-aad/portal-api-access-control.png" alt-text="Screenshot of authentication options for azure cognitive search in the portal" border="true" :::
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".
6174

62-
You can also change these settings programatically as described in the [Azure Cognitive Search RBAC Documentation](./search-security-rbac.md?tabs=config-svc-rest%2croles-powershell%2ctest-rest#step-2-preview-configuration).
75+
```http
76+
PATCH https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-Preview
77+
{
78+
"properties": {
79+
"disableLocalAuth": false,
80+
"authOptions": {
81+
"aadOrApiKey": {
82+
"aadAuthFailureMode": "http401WithBearerChallenge"
83+
}
84+
}
85+
}
86+
}
87+
```
88+
89+
---
6390
6491
## Create a managed identity
6592
@@ -111,7 +138,7 @@ It's a best practice to grant minimum permissions. If your application only need
111138
112139
You can assign multiple roles, such as Search Service Contributor and Search Index Data Contributor, if your application needs comprehensive access to the search services, objects, and content.
113140
114-
You can also [assign roles using PowerShell](./search-security-rbac.md?tabs=config-svc-rest%2croles-powershell%2ctest-rest#step-3-assign-roles).
141+
You can also [assign roles using PowerShell](search-security-rbac.md#assign-roles).
115142
116143
## Set up Azure AD authentication in your client
117144
@@ -124,15 +151,17 @@ Azure AD authentication is also supported in the preview SDKs for [Java](https:/
124151
125152
### [**.NET SDK**](#tab/aad-dotnet)
126153
127-
The Azure SDKs make it easy to integrate with Azure AD. Version [11.4.0-beta.2](https://www.nuget.org/packages/Azure.Search.Documents/11.4.0-beta.2) and newer of the .NET SDK support Azure AD authentication.
154+
Use [Azure.Search.Documents version 11.4.0](https://www.nuget.org/packages/Azure.Search.Documents/11.4.0) for Azure AD authentication.
128155
129156
The following instructions reference an existing C# sample to demonstrate the code changes.
130157
131158
1. As a starting point, clone the [source code](https://github.com/Azure-Samples/azure-search-dotnet-samples/tree/master/quickstart/v11) for the [C# quickstart](search-get-started-dotnet.md).
132159
133160
The sample currently uses key-based authentication and the `AzureKeyCredential` to create the `SearchClient` and `SearchIndexClient` but you can make a small change to switch over to role-based authentication.
134161
135-
1. Next, import the [Azure.Identity](https://www.nuget.org/packages/Azure.Identity/) library to get access to other authentication techniques.
162+
1. Update the Azure.Search.Documents Nuget package to version 11.4 or later.
163+
164+
1. Import the [Azure.Identity](https://www.nuget.org/packages/Azure.Identity/) library to get access to other authentication techniques.
136165
137166
1. Instead of using `AzureKeyCredential` in the beginning of `Main()` in [Program.cs](https://github.com/Azure-Samples/azure-search-dotnet-samples/blob/master/quickstart/v11/AzureSearchQuickstart-v11/Program.cs), use `DefaultAzureCredential` like in the code snippet below:
138167

articles/search/search-manage-rest.md

Lines changed: 24 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: REST APIs for search management
2+
title: Manage with REST
33
titleSuffix: Azure Cognitive Search
44
description: Create and configure an Azure Cognitive Search service with the Management REST API. The Management REST API is comprehensive in scope, with access to generally available and preview features.
55

@@ -36,11 +36,11 @@ All of the Management REST APIs have examples. If a task isn't covered in this a
3636

3737
## Prerequisites
3838

39-
* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-search/)
39+
* An Azure subscription - [Create one for free](https://azure.microsoft.com/free/cognitive-search/).
4040

41-
* [Postman](https://www.postman.com/downloads/) or another REST client that sends HTTP requests
41+
* [Postman](https://www.postman.com/downloads/) or another REST client that sends HTTP requests.
4242

43-
* [Azure CLI](/cli/azure/install-azure-cli) used to set up a security principle for the client
43+
* [Azure CLI](/cli/azure/install-azure-cli) used to set up a security principle for the client. You must have owner or administrator permissions to create a security principle.
4444

4545
## Create a security principal
4646

@@ -190,28 +190,25 @@ PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups
190190

191191
<a name="enable-rbac"></a>
192192

193-
## (preview) Enable Azure role-based authentication for data plane
193+
## (preview) Configure role-based access for data plane
194194

195-
To use Azure role-based access control (Azure RBAC), set "authOptions" to "aadOrApiKey" and then send the request.
195+
**Applies to:** Search Index Data Contributor, Search Index Data Reader, Search Service Contributor
196196

197-
If you want to use Azure RBAC exclusively, [turn off API key authentication](search-security-rbac.md#disable-api-key-authentication) by following up a second request, this time setting "disableLocalAuth" to "false".
197+
In this step, configure your search service to recognize an **authorization** header on data requests that provide an OAuth2 access token.
198+
199+
To use Azure role-based access control (Azure RBAC) for data plane operations, set "authOptions" to "aadOrApiKey" and then send the request.
200+
201+
If you want to use Azure RBAC exclusively, [turn off API key authentication](search-security-rbac.md#disable-api-key-authentication) by following up with a second request, this time setting "disableLocalAuth" to "true".
198202

199203
```rest
200-
PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-preview
204+
PATCH https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-preview
201205
{
202-
"location": "{{region}}",
203-
"tags": {
204-
"app-name": "My e-commerce app"
205-
},
206-
"sku": {
207-
"name": "standard"
208-
},
209206
"properties": {
210-
"replicaCount": 1,
211-
"partitionCount": 1,
212-
"hostingMode": "default",
213207
"disableLocalAuth": false,
214-
"authOptions": "aadOrApiKey"
208+
"authOptions": {
209+
"aadOrApiKey": {
210+
"aadAuthFailureMode": "http401WithBearerChallenge"
211+
}
215212
}
216213
}
217214
}
@@ -226,16 +223,9 @@ If you're using [customer-managed encryption](search-security-manage-encryption-
226223
When you enable this policy, any REST calls that create objects containing sensitive data, such as the connection string within a data source, will fail if an encryption key isn't provided: `"Error creating Data Source: "CannotCreateNonEncryptedResource: The creation of non-encrypted DataSources is not allowed when encryption policy is enforced."`
227224

228225
```rest
229-
PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-preview
226+
PATCH https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-preview
230227
{
231-
"location": "westus",
232-
"sku": {
233-
"name": "standard"
234-
},
235228
"properties": {
236-
"replicaCount": 1,
237-
"partitionCount": 1,
238-
"hostingMode": "default",
239229
"encryptionWithCmk": {
240230
"enforcement": "Enabled",
241231
"encryptionComplianceStatus": "Compliant"
@@ -251,16 +241,12 @@ PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups
251241
Although [semantic search isn't enabled](semantic-search-overview.md#enable-semantic-search) by default, you could lock down the feature at the service level.
252242

253243
```rest
254-
PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-Preview
255-
{
256-
"location": "{{region}}",
257-
"sku": {
258-
"name": "standard"
259-
},
260-
"properties": {
261-
"semanticSearch": "disabled"
262-
}
263-
}
244+
PATCH https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-Preview
245+
{
246+
"properties": {
247+
"semanticSearch": "disabled"
248+
}
249+
}
264250
```
265251

266252
<a name="disable-external-access"></a>
@@ -270,16 +256,9 @@ PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups
270256
Azure Cognitive Search [writes to external data sources](search-indexer-securing-resources.md) when updating a knowledge store, saving debug session state, or caching enrichments. The following example disables these workloads at the service level.
271257

272258
```rest
273-
PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-preview
259+
PATCH https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups/{{resource-group}}/providers/Microsoft.Search/searchServices/{{search-service-name}}?api-version=2021-04-01-preview
274260
{
275-
"location": "{{region}}",
276-
"sku": {
277-
"name": "standard"
278-
},
279261
"properties": {
280-
"replicaCount": 1,
281-
"partitionCount": 1,
282-
"hostingMode": "default",
283262
"disabledDataExfiltrationOptions": [
284263
"All"
285264
]

0 commit comments

Comments
 (0)