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
|[**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. |
27
27
|[**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. |
28
28
|[**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. |
29
29
|[**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. |
Copy file name to clipboardExpand all lines: articles/search/search-howto-aad.md
+50-21Lines changed: 50 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,40 +26,67 @@ This article shows you how to configure your client for Azure AD:
26
26
27
27
+ Update your client code to call [DefaultAzureCredential()](/dotnet/api/azure.identity.defaultazurecredential)
28
28
29
-
## Prepare your search service
29
+
## Configure role-based access for data plane
30
30
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
32
32
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.
34
34
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)
36
36
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.
38
38
39
-
1.On the left-nav pane, select **Keys**.
39
+
1.Select **Keys** in the left navigation pane.
40
40
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":::
42
42
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.
44
44
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. |
46
50
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.
49
60
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).
51
62
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.
53
64
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
+
```
55
68
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).
57
70
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".
59
72
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".
61
74
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).
@@ -111,7 +138,7 @@ It's a best practice to grant minimum permissions. If your application only need
111
138
112
139
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.
113
140
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).
115
142
116
143
## Set up Azure AD authentication in your client
117
144
@@ -124,15 +151,17 @@ Azure AD authentication is also supported in the preview SDKs for [Java](https:/
124
151
125
152
### [**.NET SDK**](#tab/aad-dotnet)
126
153
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.
128
155
129
156
The following instructions reference an existing C# sample to demonstrate the code changes.
130
157
131
158
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).
132
159
133
160
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.
134
161
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.
136
165
137
166
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:
Copy file name to clipboardExpand all lines: articles/search/search-manage-rest.md
+24-45Lines changed: 24 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: REST APIs for search management
2
+
title: Manage with REST
3
3
titleSuffix: Azure Cognitive Search
4
4
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.
5
5
@@ -36,11 +36,11 @@ All of the Management REST APIs have examples. If a task isn't covered in this a
36
36
37
37
## Prerequisites
38
38
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/).
40
40
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.
42
42
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.
44
44
45
45
## Create a security principal
46
46
@@ -190,28 +190,25 @@ PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourceGroups
190
190
191
191
<aname="enable-rbac"></a>
192
192
193
-
## (preview) Enable Azure role-based authentication for data plane
193
+
## (preview) Configure role-based access for data plane
194
194
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
196
196
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".
198
202
199
203
```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
@@ -226,16 +223,9 @@ If you're using [customer-managed encryption](search-security-manage-encryption-
226
223
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."`
227
224
228
225
```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
@@ -251,16 +241,12 @@ PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups
251
241
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.
252
242
253
243
```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
@@ -270,16 +256,9 @@ PUT https://management.azure.com/subscriptions/{{subscriptionId}}/resourcegroups
270
256
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.
271
257
272
258
```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
0 commit comments