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
Copy file name to clipboardExpand all lines: articles/search/search-security-api-keys.md
+13-12Lines changed: 13 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,24 +2,23 @@
2
2
title: Connect using API keys
3
3
titleSuffix: Azure AI Search
4
4
description: Learn how to use an admin or query API key for inbound access to an Azure AI Search service endpoint.
5
-
6
5
manager: nitinme
7
6
author: HeidiSteen
8
7
ms.author: heidist
9
8
ms.service: azure-ai-search
10
9
ms.custom:
11
10
- ignite-2023
12
11
ms.topic: how-to
13
-
ms.date: 10/30/2024
12
+
ms.date: 1/16/2025
13
+
#customer intent: I want to learn how to connect to Azure AI Search using API keys so that I can authenticate inbound requests to my search service.
14
14
---
15
15
16
16
# Connect to Azure AI Search using keys
17
17
18
-
Azure AI Search offers key-based authentication for connections to your search service. An API key is a unique string composed of 52 randomly generated numbers and letters. In your source code, you can specify it as an [environment variable](/azure/ai-services/cognitive-services-environment-variables) or as an app setting in your project, and then reference the variable on the request. A request made to a search service endpoint is accepted if both the request and the API key are valid.
19
-
20
-
Key-based authentication is the default.
18
+
Azure AI Search supports both keyless and key-based authentication for connections to your search service. An API key is a unique string composed of 52 randomly generated numbers and letters. In your source code, you can specify it as an [environment variable](/azure/ai-services/cognitive-services-environment-variables) or as an app setting in your project, and then reference the variable on the request. A request made to a search service endpoint is accepted if both the request and the API key are valid.
21
19
22
-
You can replace it with [role-based access](search-security-enable-roles.md), which eliminates the need for hardcoded keys in your codebase.
20
+
> [!IMPORTANT]
21
+
> When you create a search service, key-based authentication is the default, but it's not the most secure option. We recommend that you replace it with [role-based access](search-security-enable-roles.md).
23
22
24
23
## Types of API keys
25
24
@@ -36,11 +35,11 @@ Visually, there's no distinction between an admin key or query key. Both keys ar
36
35
37
36
## Use API keys on connections
38
37
39
-
API keys are used for data plane (content) requests, such as creating or accessing an index or, any other request that's represented in the [Search REST APIs](/rest/api/searchservice/). Upon service creation, an API key is the only authentication mechanism for data plane operations, but you can replace or supplement key authentication with [Azure roles](search-security-rbac.md) if you can't use hard-coded keys in your code.
40
-
41
-
Admin keys are used for creating, modifying, or deleting objects. Admin keys are also used to GET object definitions and system information.
38
+
API keys are used for data plane (content) requests, such as creating or accessing an index or, any other request that's represented in the [Search REST APIs](/rest/api/searchservice/).
42
39
43
-
Query keys are typically distributed to client applications that issue queries.
40
+
You can use either an API key or [Azure roles](search-security-rbac.md) for management plane (service) requests. When you use an API key:
41
+
- Admin keys are used for creating, modifying, or deleting objects. Admin keys are also used to GET object definitions and system information.
42
+
- Query keys are typically distributed to client applications that issue queries.
44
43
45
44
### [**REST API**](#tab/rest-use)
46
45
@@ -241,11 +240,13 @@ It's not possible to use [customer-managed key encryption](search-security-manag
241
240
242
241
## Best practices
243
242
243
+
+ For production workloads, switch to [Microsoft Entra ID and role-based access](keyless-connections.md). Or, if you want to continue using API keys, be sure to always monitor [who has access to your API keys](#secure-api-keys) and [regenerate API keys](#regenerate-admin-keys) on a regular cadence.
244
+
244
245
+ Only use API keys if data disclosure isn't a risk (for example, when using sample data) and if you're operating behind a firewall. Exposure of API keys is a risk to both data and to unauthorized use of your search service.
245
246
246
-
+Always check code, samples, and training material before publishing to make sure you didn't leave valid API keys behind.
247
+
+If you use an API key, store it securely somewhere else, such as in [Azure Key Vault](/azure/key-vault/general/overview). Don't include the API key directly in your code, and never post it publicly.
247
248
248
-
+For production workloads, switch to [Microsoft Entra ID and role-based access](keyless-connections.md). Or, if you want to continue using API keys, be sure to always monitor [who has access to your API keys](#secure-api-keys) and [regenerate API keys](#regenerate-admin-keys) on a regular cadence.
249
+
+Always check code, samples, and training material before publishing to make sure you don't inadvertently expose an API key.
Copy file name to clipboardExpand all lines: articles/search/search-security-enable-roles.md
+11-15Lines changed: 11 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,21 @@
2
2
title: Enable role-based access control
3
3
titleSuffix: Azure AI Search
4
4
description: Enable or disable role-based access control for token authentication using Microsoft Entra ID on Azure AI Search.
5
-
6
5
manager: nitinme
7
6
author: HeidiSteen
8
7
ms.author: heidist
9
8
ms.service: azure-ai-search
10
9
ms.topic: how-to
11
-
ms.date: 10/30/2024
12
-
10
+
ms.date: 1/16/2025
11
+
#customer intent: As a developer, I want to enable role-based access control for token authentication using Microsoft Entra ID on Azure AI Search so that I can secure my search service.
13
12
---
14
13
15
14
# Enable or disable role-based access control in Azure AI Search
16
15
17
-
Azure AI Search uses [key-based authentication](search-security-api-keys.md) by default, but it fully supports Microsoft Entra ID authentication and authorization for all control plane and data plane operations through Azure role-based access control (RBAC).
16
+
Azure AI Search supports both keyless and [key-based authentication](search-security-api-keys.md) for for all control plane and data plane operations. You can use Microsoft Entra ID authentication and authorization for all control plane and data plane operations through Azure role-based access control (RBAC).
17
+
18
+
> [!IMPORTANT]
19
+
> When you create a search service, key-based authentication is the default, but it's not the most secure option. We recommend that you replace it with role-based access as described in this article.
18
20
19
21
Before you can assign roles for authorized data plane access to Azure AI Search, you must enable role-based access control on your search service. Roles for service administration (control plane) are built in and can't be enabled or disabled.
20
22
@@ -37,18 +39,18 @@ The default failure mode for unauthorized requests is `http401WithBearerChalleng
37
39
38
40
### [**Azure portal**](#tab/config-svc-portal)
39
41
40
-
1. Sign in to the [Azure portal](https://portal.azure.com) and open the search service page.
42
+
1. Sign in to the [Azure portal](https://portal.azure.com) and navigate to your search service.
41
43
42
44
1. Select **Settings** and then select **Keys** in the left navigation pane.
43
45
44
46
:::image type="content" source="media/search-security-rbac/search-security-enable-roles.png" lightbox="media/search-security-rbac/search-security-enable-roles.png" alt-text="Screenshot of the keys page with authentication options." border="true":::
45
47
46
-
1. Choose **Role-based control** or**Both** if you're currently using keys and need time to transition clients to role-based access control.
48
+
1. Choose **Role-based control**. Only choose**Both** if you're currently using keys and need time to transition clients to role-based access control.
47
49
48
50
| Option | Description |
49
51
|--------|--------------|
50
-
| API Key |(default). Requires [API keys](search-security-api-keys.md) on the request header for authorization. |
51
-
| Role-based access control | Requires membership in a role assignment to complete the task. It also requires an authorization header on the request. |
52
+
| API Key (default)| Requires [API keys](search-security-api-keys.md) on the request header for authorization. |
53
+
| Role-based access control (recommended) | Requires membership in a role assignment to complete the task. It also requires an authorization header on the request. |
52
54
| Both | Requests are valid using either an API key or role-based access control, but if you provide both in the same request, the API key is used. |
53
55
54
56
1. As an administrator, if you choose a roles-only approach, [assign data plane roles](search-security-rbac.md) to your user account to restore full administrative access over data plane operations in the Azure portal. Roles include Search Service Contributor, Search Index Data Contributor, and Search Index Data Reader. You need the first two roles if you want equivalent access.
@@ -140,7 +142,7 @@ All calls to the Management REST API are authenticated through Microsoft Entra I
140
142
141
143
It's possible to disable role-based access control for data plane operations and use key-based authentication instead. You might do this as part of a test workflow, for example to rule out permission issues.
142
144
143
-
Reverse the steps you followed previously to enable role-based access.
145
+
To disable role-based access control in the Azure portal:
144
146
145
147
1. Sign in to the [Azure portal](https://portal.azure.com) and open the search service page.
146
148
@@ -221,12 +223,6 @@ To re-enable key authentication, set "disableLocalAuth" to false. The search ser
221
223
222
224
---
223
225
224
-
## Effects of role-based access control
225
-
226
-
+ Role-based access control can increase the latency of some requests. Each unique combination of service resource (index, indexer, skillsets and so forth) and service principal triggers an authorization check. These authorization checks can add up to 200 milliseconds of latency per request.
227
-
228
-
+ In rare cases where requests originate from a high number of different service principals, all targeting different service resources (indexes, indexers, and so forth), it's possible for the authorization checks to result in throttling. Throttling would only happen if hundreds of unique combinations of search service resource and service principal were used within a second.
Copy file name to clipboardExpand all lines: articles/search/search-security-rbac.md
-6Lines changed: 0 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -606,12 +606,6 @@ To enable a Conditional Access policy for Azure AI Search, follow these steps:
606
606
> [!IMPORTANT]
607
607
>Ifyoursearchservicehasamanagedidentityassignedtoit, thespecificsearchservicewillshowupasacloudappthatcanbeincludedorexcludedaspartoftheConditionalAccesspolicy. ConditionalAccesspoliciescan't be enforced on a specific search service. Instead make sure you select the general **Azure AI Search** cloud app.
+Inrarecaseswhererequestsoriginatefromahighnumberofdifferentserviceprincipals, alltargetingdifferentserviceresources (indexes, indexers, etc.), it's possible for the authorization checks to result in throttling. Throttling would only happen if hundreds of unique combinations of search service resource and service principal were used within a second.
614
-
615
609
## Troubleshooting role-based access control issues
0 commit comments