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-howto-managed-identities-cosmos-db.md
+17-20Lines changed: 17 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,31 +8,28 @@ ms.author: gimondra
8
8
manager: liamca
9
9
10
10
ms.service: cognitive-search
11
-
ms.topic: conceptual
12
-
ms.date: 06/20/2022
11
+
ms.topic: how-to
12
+
ms.date: 09/19/2022
13
13
ms.custom: subject-rbac-steps
14
14
---
15
15
16
-
# Set up an indexer connection to a Cosmos DB database using a managed identity
16
+
# Set up an indexer connection to Cosmos DB using a managed identity
17
17
18
-
This article describes how to set up an Azure Cognitive Search indexer connection to an Azure Cosmos DB database using a managed identity instead of providing credentials in the connection string.
18
+
This article explains how to set up an indexer connection to an Azure Cosmos DB database using a managed identity instead of providing credentials in the connection string.'
19
19
20
-
You can use a system-assigned managed identity or a user-assigned managed identity (preview). Managed identities are Azure AD logins and require Azure role assignments to access data in Cosmos DB. For detailed steps, see [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.md).
21
-
22
-
Before learning more about this feature, it is recommended that you have an understanding of what an indexer is and how to set up an indexer for your data source. More information can be found at the following links:
23
-
24
-
*[Indexer overview](search-indexer-overview.md)
25
-
*[Azure Cosmos DB indexer (SQL API)](search-howto-index-cosmosdb.md)
26
-
*[Azure Cosmos DB indexer (MongoDB API - preview)](search-howto-index-cosmosdb-mongodb.md)
27
-
*[Azure Cosmos DB indexer (Gremlin API - preview)](search-howto-index-cosmosdb-gremlin.md)
20
+
You can use a system-assigned managed identity or a user-assigned managed identity (preview). Managed identities are Azure Active Directory logins and require Azure role assignments to access data in Cosmos DB.
28
21
29
22
## Prerequisites
30
23
31
24
*[Create a managed identity](search-howto-managed-identities-data-sources.md) for your search service.
32
25
33
-
*[Assign a role](search-howto-managed-identities-data-sources.md#assign-a-role) in Cosmos DB. For data reader access, you'll need the **Cosmos DB Account Reader** role and the identity used to make the request. This role works for all Cosmos DB APIs supported by Cognitive Search. This is a control plane RBAC role. At this time, Cognitive Search obtains keys with the identity and uses those keys to connect to the Cosmos DB account. This means that [enforcing RBAC as the only authentication method in Cosmos DB](../cosmos-db/how-to-setup-rbac.md#disable-local-auth) is not supported when using Search with managed identities to connect to Cosmos DB.
26
+
*[Assign a role](search-howto-managed-identities-data-sources.md#assign-a-role) in Cosmos DB.
27
+
28
+
For data reader access, you'll need the **Cosmos DB Account Reader** role and the identity used to make the request. This role works for all Cosmos DB APIs supported by Cognitive Search. This is a control plane RBAC role.
29
+
30
+
At this time, Cognitive Search obtains keys with the identity and uses those keys to connect to the Cosmos DB account. This means that [enforcing RBAC as the only authentication method in Cosmos DB](../cosmos-db/how-to-setup-rbac.md#disable-local-auth) isn't supported when using Search with managed identities to connect to Cosmos DB.
34
31
35
-
The easiest way to test the connection is using the [Import data wizard](search-import-data-portal.md). The wizard supports data source connections for both system and user managed identities.
32
+
* You should be familiar with [indexer concepts](search-indexer-overview.md)and [configuration](search-howto-index-cosmosdb.md).
36
33
37
34
## Create the data source
38
35
@@ -44,11 +41,11 @@ The [REST API](/rest/api/searchservice/create-data-source), Azure portal, and th
44
41
45
42
When you're connecting with a system-assigned managed identity, the only change to the data source definition is the format of the "credentials" property. You'll provide the database name and a ResourceId that has no account key or password. The ResourceId must include the subscription ID of Cosmos DB, the resource group, and the Cosmos DB account name.
46
43
47
-
* For SQL collections, the connection string does not require "ApiKind".
44
+
* For SQL collections, the connection string doesn't require "ApiKind".
48
45
* For MongoDB collections, add "ApiKind=MongoDb" to the connection string and use a preview REST API.
49
46
* For Gremlin graphs, add "ApiKind=Gremlin" to the connection string and use a preview REST API.
50
47
51
-
Here is an example of how to create a data source to index data from a storage account using the [Create Data Source](/rest/api/searchservice/create-data-source) REST API and a managed identity connection string. The managed identity connection string format is the same for the REST API, .NET SDK, and the Azure portal.
48
+
Here's an example of how to create a data source to index data from a storage account using the [Create Data Source](/rest/api/searchservice/create-data-source) REST API and a managed identity connection string. The managed identity connection string format is the same for the REST API, .NET SDK, and the Azure portal.
52
49
53
50
```http
54
51
POST https://[service name].search.windows.net/datasources?api-version=2020-06-30
@@ -74,13 +71,13 @@ The 2021-04-30-preview REST API supports connections based on a user-assigned ma
74
71
75
72
* First, the format of the "credentials" property is the database name and a ResourceId that has no account key or password. The ResourceId must include the subscription ID of Cosmos DB, the resource group, and the Cosmos DB account name.
76
73
77
-
* For SQL collections, the connection string does not require "ApiKind".
74
+
* For SQL collections, the connection string doesn't require "ApiKind".
78
75
* For MongoDB collections, add "ApiKind=MongoDb" to the connection string
79
76
* For Gremlin graphs, add "ApiKind=Gremlin" to the connection string.
80
77
81
78
* Second, you'll add an "identity" property that contains the collection of user-assigned managed identities. Only one user-assigned managed identity should be provided when creating the data source. Set it to type "userAssignedIdentities".
82
79
83
-
Here is an example of how to create an indexer data source object using the [preview Create or Update Data Source](/rest/api/searchservice/preview-api/create-or-update-data-source) REST API:
80
+
Here's an example of how to create an indexer data source object using the [preview Create or Update Data Source](/rest/api/searchservice/preview-api/create-or-update-data-source) REST API:
84
81
85
82
86
83
```http
@@ -127,7 +124,7 @@ api-key: [admin key]
127
124
128
125
## Create the indexer
129
126
130
-
An indexer connects a data source with a target search index and provides a schedule to automate the data refresh. Once the index and data source have been created, you're ready to create and run the indexer.
127
+
An indexer connects a data source with a target search index and provides a schedule to automate the data refresh. Once the index and data source have been created, you're ready to create and run the indexer. If the indexer is successful, the connection syntax and role assignments are valid.
131
128
132
129
Here's a [Create Indexer](/rest/api/searchservice/create-indexer) REST API call with a Cosmos DB indexer definition. The indexer will run when you submit the request.
133
130
@@ -145,7 +142,7 @@ Here's a [Create Indexer](/rest/api/searchservice/create-indexer) REST API call
145
142
146
143
## Troubleshooting
147
144
148
-
If you recently rotated your Cosmos DB account keys you will need to wait up to 15 minutes for the managed identity connection string to work.
145
+
If you recently rotated your Cosmos DB account keys you'll need to wait up to 15 minutes for the managed identity connection string to work.
149
146
150
147
Check to see if the Cosmos DB account has its access restricted to select networks. You can rule out any firewall issues by trying the connection without restrictions in place.
Copy file name to clipboardExpand all lines: articles/search/search-howto-managed-identities-data-sources.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
@@ -19,7 +19,7 @@ You can configure an Azure Cognitive Search service to connect to other Azure re
19
19
20
20
+ A search service at the [Basic tier or above](search-sku-tier.md).
21
21
22
-
+ An Azure resource that accepts incoming requests from an Azure AD login that has a valid role assignment.
22
+
+ An Azure resource that accepts incoming requests from an Azure Active Directory login that has a valid role assignment.
23
23
24
24
## Supported scenarios
25
25
@@ -115,7 +115,7 @@ A user-assigned managed identity is a resource on Azure. It's useful if you need
115
115
116
116
1. In the "Search services and marketplace" search bar, search for "User Assigned Managed Identity" and then select **Create**.
117
117
118
-
:::image type="content" source="media/search-managed-identities/user-assigned-managed-identity.png" alt-text="Screenshot of the user assigned managed identity tile in Azure marketplace.":::
118
+
:::image type="content" source="media/search-managed-identities/user-assigned-managed-identity.png" alt-text="Screenshot of the user assigned managed identity tile in Azure Marketplace.":::
119
119
120
120
1. Select the subscription, resource group, and region. Give the identity a descriptive name.
Copy file name to clipboardExpand all lines: articles/search/search-howto-managed-identities-sql.md
+13-18Lines changed: 13 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,28 +8,23 @@ ms.author: gimondra
8
8
manager: nitinme
9
9
ms.custom: subject-rbac-steps
10
10
ms.service: cognitive-search
11
-
ms.topic: conceptual
12
-
ms.date: 02/11/2022
11
+
ms.topic: how-to
12
+
ms.date: 09/19/2022
13
13
---
14
14
15
-
# Set up an indexer connection to Azure SQL Database using a managed identity
15
+
# Set up an indexer connection to Azure SQL using a managed identity
16
16
17
-
This article describes how to set up an Azure Cognitive Search indexer connection to Azure SQL Database using a managed identity instead of providing credentials in the connection string.
17
+
This article explains how to set up an indexer connection to Azure SQL Database using a managed identity instead of providing credentials in the connection string.
18
18
19
-
You can use a system-assigned managed identity or a user-assigned managed identity (preview). Managed identities are Azure AD logins and require Azure role assignments to access data in Azure SQL.
20
-
21
-
Before learning more about this feature, it is recommended that you have an understanding of what an indexer is and how to set up an indexer for your data source. More information can be found at the following links:
You can use a system-assigned managed identity or a user-assigned managed identity (preview). Managed identities are Azure Active Directory logins and require Azure role assignments to access data in Azure SQL.
25
20
26
21
## Prerequisites
27
22
28
23
*[Create a managed identity](search-howto-managed-identities-data-sources.md) for your search service.
29
24
30
-
*Azure AD admin role on SQL:
25
+
*[Assign an Azure admin role on SQL](/azure/azure-sql/database/authentication-aad-configure). The identity used on the indexer connection needs read permissions. You must be an Azure AD admin with a server in SQL Database or SQL Managed Instance to grant read permissions on a database.
31
26
32
-
To assign read permissions on the database, you must be an Azure AD admin with a server in SQL Database or SQL Managed Instance. See [Configure and manage Azure AD authentication with Azure SQL](/azure/azure-sql/database/authentication-aad-configure) and follow the steps to provision an Azure AD admin.
27
+
* You should be familiar with [indexer concepts](search-indexer-overview.md)and [configuration](search-howto-connecting-azure-sql-database-to-azure-search-using-indexers.md).
33
28
34
29
## 1 - Assign permissions to read the database
35
30
@@ -66,7 +61,7 @@ DROP USER IF EXISTS [insert your search service name or user-assigned managed id
66
61
67
62
## 2 - Add a role assignment
68
63
69
-
In this section you'll give your Azure Cognitive Search service permission to read data from your SQL Server. For detailed steps, see [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.md).
64
+
In this section you'll, give your Azure Cognitive Search service permission to read data from your SQL Server. For detailed steps, see [Assign Azure roles using the Azure portal](../role-based-access-control/role-assignments-portal.md).
70
65
71
66
1. In the Azure portal, navigate to your Azure SQL Server page.
72
67
@@ -98,7 +93,7 @@ The [REST API](/rest/api/searchservice/create-data-source), Azure portal, and th
98
93
99
94
When you're connecting with a system-assigned managed identity, the only change to the data source definition is the format of the "credentials" property. You'll provide an Initial Catalog or Database name and a ResourceId that has no account key or password. The ResourceId must include the subscription ID of Azure SQL Database, the resource group of SQL Database, and the name of the SQL database.
100
95
101
-
Here is an example of how to create a data source to index data from a storage account using the [Create Data Source](/rest/api/searchservice/create-data-source) REST API and a managed identity connection string. The managed identity connection string format is the same for the REST API, .NET SDK, and the Azure portal.
96
+
Here's an example of how to create a data source to index data from a storage account using the [Create Data Source](/rest/api/searchservice/create-data-source) REST API and a managed identity connection string. The managed identity connection string format is the same for the REST API, .NET SDK, and the Azure portal.
102
97
103
98
```http
104
99
POST https://[service name].search.windows.net/datasources?api-version=2020-06-30
@@ -125,7 +120,7 @@ The 2021-04-30-preview REST API supports connections based on a user-assigned ma
125
120
126
121
* Second, you'll add an "identity" property that contains the collection of user-assigned managed identities. Only one user-assigned managed identity should be provided when creating the data source. Set it to type "userAssignedIdentities".
127
122
128
-
Here is an example of how to create an indexer data source object using the [preview Create or Update Data Source](/rest/api/searchservice/preview-api/create-or-update-data-source) REST API:
123
+
Here's an example of how to create an indexer data source object using the [preview Create or Update Data Source](/rest/api/searchservice/preview-api/create-or-update-data-source) REST API:
129
124
130
125
```http
131
126
POST https://[service name].search.windows.net/datasources?api-version=2021-04-30-preview
@@ -170,7 +165,7 @@ api-key: [admin key]
170
165
171
166
## 5 - Create the indexer
172
167
173
-
An indexer connects a data source with a target search index, and provides a schedule to automate the data refresh. Once the index and data source have been created, you're ready to create the indexer.
168
+
An indexer connects a data source with a target search index, and provides a schedule to automate the data refresh. Once the index and data source have been created, you're ready to create the indexer. If the indexer is successful, the connection syntax and role assignments are valid.
174
169
175
170
Here's a [Create Indexer](/rest/api/searchservice/create-indexer) REST API call with an Azure SQL indexer definition. The indexer will run when you submit the request.
176
171
@@ -183,11 +178,11 @@ api-key: [admin key]
183
178
"name" : "sql-indexer",
184
179
"dataSourceName" : "sql-datasource",
185
180
"targetIndexName" : "my-target-index"
186
-
```
181
+
```
187
182
188
183
## Troubleshooting
189
184
190
-
If you get an error when the indexer tries to connect to the data source that says that the client is not allowed to access the server, take a look at [common indexer errors](./search-indexer-troubleshooting.md).
185
+
If you get an error when the indexer tries to connect to the data source that says that the client isn't allowed to access the server, take a look at [common indexer errors](./search-indexer-troubleshooting.md).
191
186
192
187
You can also rule out any firewall issues by trying the connection with and without restrictions in place.
0 commit comments