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/keyless-connections.md
+3-2Lines changed: 3 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -323,7 +323,7 @@ Deploy production workloads includes these steps:
323
323
324
324
### Roles for production workloads
325
325
326
-
To create your production resources, you need to create a user-assigend [managed identity](/entra/identity/managed-identities-azure-resources/how-manage-user-assigned-managed-identities?pivots=identity-mi-methods-azp#create-a-user-assigned-managed-identity) then assign that identity to your resources with the correct roles.
326
+
To create your production resources, you need to create a [user-assigned managed identity](/entra/identity/managed-identities-azure-resources/how-manage-user-assigned-managed-identities?pivots=identity-mi-methods-azp#create-a-user-assigned-managed-identity) then assign that identity to your resources with the correct roles.
327
327
328
328
The following role is suggested for a production application:
329
329
@@ -390,4 +390,5 @@ Create environment variables for your deployed and keyless Azure AI Search resou
Copy file name to clipboardExpand all lines: articles/search/search-get-started-rest.md
+82-9Lines changed: 82 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,13 @@ ms.author: heidist
9
9
ms.service: cognitive-search
10
10
ms.topic: quickstart
11
11
ms.devlang: rest-api
12
-
ms.date: 03/14/2024
12
+
ms.date: 06/27/2024
13
13
ms.custom:
14
14
- mode-api
15
15
- ignite-2023
16
16
---
17
17
18
-
# Quickstart: Text search by using REST
18
+
# Quickstart: Keyword search by using REST
19
19
20
20
The REST APIs in Azure AI Search provide programmatic access to all of its capabilities, including preview features, and they're an easy way to learn how features work. In this quickstart, learn how to call the [Search REST APIs](/rest/api/searchservice) to create, load, and query a search index in Azure AI Search.
21
21
@@ -24,23 +24,84 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
24
24
## Prerequisites
25
25
26
26
-[Visual Studio Code](https://code.visualstudio.com/download) with a [REST client](https://marketplace.visualstudio.com/items?itemName=humao.rest-client).
27
+
27
28
-[Azure AI Search](search-what-is-azure-search.md). [Create](search-create-service-portal.md) or [find an existing Azure AI Search resource](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Search%2FsearchServices) under your current subscription. You can use a free service for this quickstart.
28
29
29
30
## Download files
30
31
31
-
[Download a REST sample](https://github.com/Azure-Samples/azure-search-rest-samples/tree/main/Quickstart) from GitHub to send the requests in this quickstart. For more information, see[Downloading files from GitHub](https://docs.github.com/get-started/start-your-journey/downloading-files-from-github).
32
+
[Download a REST sample](https://github.com/Azure-Samples/azure-search-rest-samples/tree/main/Quickstart) from GitHub to send the requests in this quickstart. Instructions can be found at[Downloading files from GitHub](https://docs.github.com/get-started/start-your-journey/downloading-files-from-github).
32
33
33
34
You can also start a new file on your local system and create requests manually by using the instructions in this article.
34
35
35
-
## Copy a search service key and URL
36
+
## Get a search service endpoint
37
+
38
+
You can find the search service endpoint in the Azure portal.
39
+
40
+
1. Sign in to the [Azure portal](https://portal.azure.com) and [find your search service](https://portal.azure.com/#blade/HubsExtension/BrowseResourceBlade/resourceType/Microsoft.Search%2FsearchServices).
41
+
42
+
1. On the **Overview** home page, find the URL. An example endpoint might look like `https://mydemo.search.windows.net`.
43
+
44
+
:::image type="content" source="media/search-get-started-rest/get-endpoint.png" lightbox="media/search-get-started-rest/get-endpoint.png" alt-text="Screenshot of the URL property on the overview page.":::
45
+
46
+
You're pasting this endpoint into the `.rest` or `.http` file in a later step.
47
+
48
+
## Configure access
49
+
50
+
Requests to the search endpoint must be authenticated and authorized. You can use API keys or roles for this task. Keys are easier to start with, but roles are more secure.
51
+
52
+
### Option 1: Use keys
53
+
54
+
Select **Settings** > **Keys** and then copy an admin key. Admin keys are used to add, modify, and delete objects. There are two interchangeable admin keys. Copy either one. For more information, see [Connect to Azure AI Search using key authentication](search-security-api-keys.md).
55
+
56
+
:::image type="content" source="media/search-get-started-rest/get-api-key.png" lightbox="media/search-get-started-rest/get-api-key.png" alt-text="Screenshot that shows the API keys in the Azure portal.":::
57
+
58
+
You're pasting this key into the `.rest` or `.http` file in a later step.
59
+
60
+
### Option 2: Use roles
61
+
62
+
Make sure your search service is [configured for role-based access](search-security-enable-roles.md). You must have preconfigured [role-assignments for developer access](search-security-rbac.md#assign-roles-for-development). Your role assignments must grant permission to create, load, and query a search index.
63
+
64
+
In this section, obtain your personal identity token using either the Azure CLI, Azure PowerShell, or the Azure portal.
65
+
66
+
#### [Azure CLI](#tab/azure-cli)
67
+
68
+
1. Sign in to Azure CLI.
69
+
70
+
```azurecli
71
+
az login
72
+
```
73
+
74
+
1. Get your personal identity.
36
75
37
-
REST calls require the search service endpoint and an API key on every request. You can get these values from the Azure portal.
Use the steps found here: [find the user object ID](/partner-center/find-ids-and-domain-names#find-the-user-object-id) in the Azure portal.
38
98
39
-
1. Sign in to the [Azure portal](https://portal.azure.com). Then go to the search service **Overview** page and copy the URL. An example endpoint might look like `https://mydemo.search.windows.net`.
99
+
---
40
100
41
-
1. Select **Settings** > **Keys** and then copy an admin key. Admin keys are used to add, modify, and delete objects. There are two interchangeable admin keys. Copy either one.
101
+
You're pasting your personal identity token into the `.rest` or `.http` file in a later step.
42
102
43
-
:::image type="content" source="media/search-get-started-rest/get-url-key.png" alt-text="Screenshot that shows the URL and API keys in the Azure portal.":::
103
+
> [!NOTE]
104
+
> This section assumes you're using a local client that connects to Azure AI Search on your behalf. An alternative approach is [getting a token for the client app](/entra/identity-platform/v2-oauth2-client-creds-grant-flow), assuming your application is [registered](/entra/identity-platform/quickstart-register-app) with Microsoft Entra ID.
44
105
45
106
## Set up Visual Studio Code
46
107
@@ -54,7 +115,7 @@ If you're not familiar with the REST client for Visual Studio Code, this section
54
115
55
116
1. Open or create a new file named with either a `.rest` or `.http` file extension.
56
117
57
-
1. Paste in the following example. Replace the base URL and API key with the values you copied earlier.
118
+
1. Paste in the following example if you're using API keys. Replace the `@baseUrl` and `@apiKey` placeholders with the values you copied earlier.
58
119
59
120
```http
60
121
@baseUrl = PUT-YOUR-SEARCH-SERVICE-ENDPOINT-HERE
@@ -66,6 +127,18 @@ If you're not familiar with the REST client for Visual Studio Code, this section
66
127
api-key: {{apiKey}}
67
128
```
68
129
130
+
1. Or, paste in this example if your using roles. Replace the `@baseUrl` and `@token` placeholders with the values you copied earlier.
131
+
132
+
```http
133
+
@baseUrl = PUT-YOUR-SEARCH-SERVICE-ENDPOINT-HERE
134
+
@token = PUT-YOUR-PERSONAL-IDENTITY-TOKEN-HERE
135
+
136
+
### List existing indexes by name
137
+
GET {{baseUrl}}/indexes?api-version=2023-11-01&$select=name HTTP/1.1
138
+
Content-Type: application/json
139
+
Authorization: Bearer {{token}}
140
+
```
141
+
69
142
1. Select **Send request**. A response should appear in an adjacent pane. If you have existing indexes, they're listed. Otherwise, the list is empty. If the HTTP code is `200 OK`, you're ready for the next steps.
70
143
71
144
:::image type="content" source="media/search-get-started-rest/rest-client-request-setup.png" lightbox="media/search-get-started-rest/rest-client-request-setup.png" alt-text="Screenshot that shows a REST client configured for a search service request.":::
0 commit comments