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/includes/quickstarts/full-text-rest.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,11 +89,11 @@ To set up your request file:
89
89
@token = PUT-YOUR-PERSONAL-IDENTITY-TOKEN-HERE
90
90
91
91
### List existing indexes by name
92
-
GET {{baseUrl}}/indexes?api-version=2024-07-01
92
+
GET {{baseUrl}}/indexes?api-version=2024-07-01 HTTP/1.1
93
93
Authorization: Bearer {{token}}
94
94
```
95
95
96
-
1. Replace the `@baseUrl` and `@token` placeholders with the values you obtained in [Get endpoint and token](#get-endpoint-and-token).
96
+
1. Replace the `@baseUrl` and `@token` placeholders with the values you obtained in [Get endpoint and token](#get-endpoint-and-token). Don't include quotation marks.
97
97
98
98
1. Under `### List existing indexes by name`, select **Send Request**.
Copy file name to clipboardExpand all lines: articles/search/includes/quickstarts/search-get-started-rbac-python.md
+35-19Lines changed: 35 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,12 @@ author: haileytap
4
4
ms.author: haileytapia
5
5
ms.service: azure-ai-search
6
6
ms.topic: include
7
-
ms.date: 07/08/2025
7
+
ms.date: 07/09/2025
8
8
---
9
9
10
-
In this quickstart, you use role-based access control (RBAC) and Microsoft Entra ID to connect to Azure AI Search from your local system. You then use Python in Visual Studio Code to interact with your search service.
10
+
In this quickstart, you use role-based access control (RBAC) and Microsoft Entra ID to establish a keyless connection to your Azure AI Search service. You then use Python in Visual Studio Code to interact with the service.
11
11
12
-
We recommend keyless connections for granular permissions and identity-based authentication, which eliminate the need for hard-coded API keys in your code. However, if you prefer key-based connections, see [Connect to Azure AI Search using keys](../../search-security-api-keys.md).
12
+
Keyless connections provide enhanced security through granular permissions and identity-based authentication. We don't recommend hard-coded API keys, but if you prefer them, see [Connect to Azure AI Search using keys](../../search-security-api-keys.md).
13
13
14
14
<!-- This quickstart is a prerequisite for other quickstarts that use Microsoft Entra ID with role assignments. -->
15
15
@@ -25,25 +25,30 @@ We recommend keyless connections for granular permissions and identity-based aut
Before you establish a keyless connection to your Azure AI Search service, you must use the Azure CLI to authenticate your identity with Microsoft Entra ID.
30
+
Before you connect to your Azure AI Search service, use the Azure CLI to sign in to the subscription that contains the service. This step establishes your Microsoft Entra identity, which `DefaultAzureCredential` uses to authenticate requests in the next section.
31
31
32
-
To set up authentication:
32
+
To sign in:
33
33
34
34
1. On your local system, open a command-line tool.
35
35
36
-
1. Sign in to the subscription whose ID you obtained in [Get service information](#get-service-information).
36
+
1. Sign in to Azure.
37
37
38
38
```azurecli
39
39
az login
40
40
```
41
41
42
+
1. (Conditional) If you have multiple subscriptions, select the one whose ID you obtained in [Get service information](#get-service-information).
43
+
42
44
## Connect to Azure AI Search
43
45
44
-
You can use the Python extension and Jupyter package to send requests to your Azure AI Search service. For request authentication, use the `DefaultAzureCredential` class from the Azure Identity library.
46
+
> [!NOTE]
47
+
> This section illustrates the basic Python pattern for keyless connections. For comprehensive guidance, see a specific quickstart or tutorial, such as [Quickstart: Run agentic retrieval in Azure AI Search](../../search-quickstart-agentic-retrieval.md).
48
+
49
+
You can use Python notebooks in Visual Studio Code to send requests to your Azure AI Search service. For request authentication, use the `DefaultAzureCredential` class from the Azure Identity library.
45
50
46
-
To use Python for keyless connections:
51
+
To connect using Python:
47
52
48
53
1. On your local system, open Visual Studio Code.
49
54
@@ -55,27 +60,38 @@ To use Python for keyless connections:
55
60
pip install azure-identity azure-search-documents
56
61
```
57
62
58
-
1. Create another code cell to authenticate with `DefaultAzureCredential`and connect to your search service.
63
+
1. Create another code cell to authenticate and connect to your search service.
59
64
60
65
```python
61
66
from azure.identity import DefaultAzureCredential
62
-
from azure.search.documents importSearchClient
67
+
from azure.search.documents.indexesimportSearchIndexClient
1. Set `service_endpoint` to the value you obtained in [Get service information](#get-service-information).
82
+
83
+
1. Select **Run All** to run both code cells.
84
+
85
+
The output should list existing indexes on your search service, indicating a successful connection.
86
+
75
87
### Troubleshoot 401 errors
76
88
89
+
If you encounter a 401 error, follow these troubleshooting steps:
90
+
77
91
+ Revisit [Configure role-based access](#configure-role-based-access). Your search service must have **Role-based access control** or **Both** enabled. Policies at the subscription or resource group level might also override your role assignments.
78
92
79
-
+ Revisit [Set up authentication](#set-up-authentication). You must sign in to the correct subscription for your search service.
93
+
+ Revisit [Sign in to Azure](#sign-in-to-azure). You must sign in to the subscription that contains your search service.
94
+
95
+
+ Make sure your endpoint variable has surrounding quotes.
80
96
81
-
If all else fails, restart your device to remove cached tokens and then repeat the steps in this quickstart, starting with [Set up authentication](#set-up-authentication).
97
+
+If all else fails, restart your device to remove cached tokens and then repeat the steps in this quickstart, starting with [Sign in to Azure](#sign-in-to-azure).
Copy file name to clipboardExpand all lines: articles/search/includes/quickstarts/search-get-started-rbac-rest.md
+31-31Lines changed: 31 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,12 @@ author: haileytap
4
4
ms.author: haileytapia
5
5
ms.service: azure-ai-search
6
6
ms.topic: include
7
-
ms.date: 07/08/2025
7
+
ms.date: 07/09/2025
8
8
---
9
9
10
-
In this quickstart, you use role-based access control (RBAC) and Microsoft Entra ID to connect to Azure AI Search from your local system. You then use REST in Visual Studio Code to interact with your search service.
10
+
In this quickstart, you use role-based access control (RBAC) and Microsoft Entra ID to establish a keyless connection to your Azure AI Search service. You then use REST in Visual Studio Code to interact with the service.
11
11
12
-
We recommend keyless connections for granular permissions and identity-based authentication, which eliminate the need for hard-coded API keys in your code. However, if you prefer key-based connections, see [Connect to Azure AI Search using keys](../../search-security-api-keys.md).
12
+
Keyless connections provide enhanced security through granular permissions and identity-based authentication. We don't recommend hard-coded API keys, but if you prefer them, see [Connect to Azure AI Search using keys](../../search-security-api-keys.md).
13
13
14
14
<!-- This quickstart is a prerequisite for other quickstarts that use Microsoft Entra ID with role assignments. -->
15
15
@@ -25,73 +25,73 @@ We recommend keyless connections for granular permissions and identity-based aut
Before you establish a keyless connection to your Azure AI Search service, you must use the Azure CLI to authenticate your identity and generate a Microsoft Entra ID token. You specify this token in the next section.
30
+
Before you connect to your Azure AI Search service, use the Azure CLI to sign in to the subscription that contains the service and generate a Microsoft Entra ID token. You use this token to authenticate requests in the next section.
31
31
32
-
To set up authentication:
32
+
To get your token:
33
33
34
34
1. On your local system, open a command-line tool.
35
35
36
-
1. Sign in to the subscription whose ID you obtained in [Get service information](#get-service-information).
36
+
1. Sign in to Azure.
37
37
38
38
```azurecli
39
39
az login
40
40
```
41
41
42
+
1. (Conditional) If you have multiple subscriptions, select the one whose ID you obtained in [Get service information](#get-service-information).
43
+
42
44
1. Generate an access token.
43
45
44
-
```azurecli
45
-
az account get-access-token --scope https://search.azure.com/.default --query accessToken --output tsv
46
-
```
46
+
```azurecli
47
+
az account get-access-token --scope https://search.azure.com/.default --query accessToken --output tsv
48
+
```
47
49
48
-
1. Make a note of the token.
50
+
1. Make a note of the token output.
49
51
50
52
## Connect to Azure AI Search
51
53
52
-
You can use the REST Client extension to send requests to Azure AI Search. For request authentication, include an `Authorization` header with the Microsoft Entra ID token you previously generated.
54
+
> [!NOTE]
55
+
> This section illustrates the basic REST pattern for keyless connections. For comprehensive guidance, see a specific quickstart or tutorial, such as [Quickstart: Run agentic retrieval in Azure AI Search](../../search-quickstart-agentic-retrieval.md).
53
56
54
-
To use REST for keyless connections:
57
+
You can use the REST Client extension in Visual Studio Code to send requests to your Azure AI Search service. For request authentication, include an `Authorization` header with the Microsoft Entra ID token you previously generated.
58
+
59
+
To connect using REST:
55
60
56
61
1. On your local system, open Visual Studio Code.
57
62
58
63
1. Create a `.rest` or `.http` file.
59
64
60
-
1. Paste the following placeholders into the file.
65
+
1. Paste the following placeholders and request into the file.
61
66
62
67
```http
63
68
@baseUrl = PUT-YOUR-SEARCH-SERVICE-ENDPOINT-HERE
64
69
@token = PUT-YOUR-PERSONAL-IDENTITY-TOKEN-HERE
70
+
71
+
### List existing indexes
72
+
GET {{baseUrl}}/indexes?api-version=2024-07-01 HTTP/1.1
73
+
Content-Type: application/json
74
+
Authorization: Bearer {{token}}
65
75
```
66
76
67
77
1. Replace `@baseUrl` with the value you obtained in [Get service information](#get-service-information).
68
78
69
-
1. Replace `@token` with the value you obtained in [Set up authentication](#set-up-authentication).
79
+
1. Replace `@token` with the value you obtained in [Get token](#get-token).
70
80
71
-
1.Make a REST call to authenticate with your token and connect to your search service.
81
+
1.Under `### List existing indexes`, select **Send Request**.
72
82
73
-
```http
74
-
POST https://{{baseUrl}}/indexes/hotels-sample-index/docs/search?api-version=2024-07-01 HTTP/1.1
75
-
Content-type: application/json
76
-
Authorization: Bearer {{token}}
77
-
78
-
{
79
-
"queryType": "simple",
80
-
"search": "beach access",
81
-
"filter": "",
82
-
"select": "HotelName,Description,Category,Tags",
83
-
"count": true
84
-
}
85
-
```
83
+
You should receive an `HTTP/1.1 200 OK` response, indicating a successful connection to your search service.
86
84
87
85
### Troubleshoot 401 errors
88
86
87
+
If you encounter a 401 error, follow these troubleshooting steps:
88
+
89
89
+ Revisit [Configure role-based access](#configure-role-based-access). Your search service must have **Role-based access control** or **Both** enabled. Policies at the subscription or resource group level might also override your role assignments.
90
90
91
-
+ Revisit [Set up authentication](#set-up-authentication). You must sign in to the correct subscription for your search service.
91
+
+ Revisit [Get token](#get-token). You must sign in to the subscription that contains your search service.
92
92
93
93
+ Make sure your endpoint and token variables don't have surrounding quotes or extra spaces.
94
94
95
95
+ Make sure your token doesn't have the `@` symbol in the request header. For example, if the variable is `@token`, the reference in the request should be `{{token}}`.
96
96
97
-
If all else fails, restart your device to remove cached tokens and then repeat the steps in this quickstart, starting with [Set up authentication](#set-up-authentication).
97
+
+If all else fails, restart your device to remove cached tokens and then repeat the steps in this quickstart, starting with [Get token](#get-token).
Copy file name to clipboardExpand all lines: articles/search/includes/quickstarts/search-get-started-rbac-setup.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,17 +19,21 @@ To configure access:
19
19
20
20
1. Select **Role-based access control** or **Both** if you need time to transition clients to RBAC.
21
21
22
+
:::image type="content" source="../../media/search-get-started-rbac/access-control-options.png" lightbox="../../media/search-get-started-rbac/access-control-options.png" alt-text="Screenshot of the access control options in the Azure portal.":::
23
+
22
24
1. From the left pane, select **Access control (IAM)**.
23
25
24
26
1. Select **Add** > **Add role assignment**.
25
27
28
+
:::image type="content" source="../../media/search-get-started-rbac/add-role-assignment.png" lightbox="../../media/search-get-started-rbac/add-role-assignment.png" alt-text="Screenshot of the dropdown menu for adding a role assignment in the Azure portal.":::
29
+
26
30
1. Assign the **Search Service Contributor** role to your user account or managed identity.
27
31
28
32
1. Repeat the role assignment for **Search Index Data Contributor**.
29
33
30
34
## Get service information
31
35
32
-
In this section, you retrieve the subscription ID and endpoint of your Azure AI Search service. You use these values for authentication and connection in the following sections.
36
+
In this section, you retrieve the subscription ID and endpoint of your Azure AI Search service. If you have one subscription, skip the subscription ID and only retrieve the endpoint. You use these values in the remaining sections of this quickstart.
0 commit comments