Skip to content

Commit 27eb7d7

Browse files
authored
Merge pull request #211808 from HeidiSteen/heidist-fresh
[azure search] Freshness pass on managed identity how-to's
2 parents c590e52 + 61db905 commit 27eb7d7

4 files changed

+49
-64
lines changed

articles/search/search-howto-managed-identities-cosmos-db.md

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,28 @@ ms.author: gimondra
88
manager: liamca
99

1010
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
1313
ms.custom: subject-rbac-steps
1414
---
1515

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
1717

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.'
1919

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.
2821

2922
## Prerequisites
3023

3124
* [Create a managed identity](search-howto-managed-identities-data-sources.md) for your search service.
3225

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.
3431

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).
3633

3734
## Create the data source
3835

@@ -44,11 +41,11 @@ The [REST API](/rest/api/searchservice/create-data-source), Azure portal, and th
4441

4542
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.
4643

47-
* For SQL collections, the connection string does not require "ApiKind".
44+
* For SQL collections, the connection string doesn't require "ApiKind".
4845
* For MongoDB collections, add "ApiKind=MongoDb" to the connection string and use a preview REST API.
4946
* For Gremlin graphs, add "ApiKind=Gremlin" to the connection string and use a preview REST API.
5047

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.
5249

5350
```http
5451
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
7471

7572
* 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.
7673

77-
* For SQL collections, the connection string does not require "ApiKind".
74+
* For SQL collections, the connection string doesn't require "ApiKind".
7875
* For MongoDB collections, add "ApiKind=MongoDb" to the connection string
7976
* For Gremlin graphs, add "ApiKind=Gremlin" to the connection string.
8077

8178
* 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".
8279

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:
8481

8582

8683
```http
@@ -127,7 +124,7 @@ api-key: [admin key]
127124

128125
## Create the indexer
129126

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.
131128

132129
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.
133130

@@ -145,7 +142,7 @@ Here's a [Create Indexer](/rest/api/searchservice/create-indexer) REST API call
145142

146143
## Troubleshooting
147144

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.
149146

150147
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.
151148

articles/search/search-howto-managed-identities-data-sources.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ You can configure an Azure Cognitive Search service to connect to other Azure re
1919

2020
+ A search service at the [Basic tier or above](search-sku-tier.md).
2121

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.
2323

2424
## Supported scenarios
2525

@@ -115,7 +115,7 @@ A user-assigned managed identity is a resource on Azure. It's useful if you need
115115
116116
1. In the "Search services and marketplace" search bar, search for "User Assigned Managed Identity" and then select **Create**.
117117
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.":::
119119
120120
1. Select the subscription, resource group, and region. Give the identity a descriptive name.
121121

articles/search/search-howto-managed-identities-sql.md

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,23 @@ ms.author: gimondra
88
manager: nitinme
99
ms.custom: subject-rbac-steps
1010
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
1313
---
1414

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
1616

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.
1818

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:
22-
23-
* [Indexer overview](search-indexer-overview.md)
24-
* [Azure SQL indexer](search-howto-connecting-azure-sql-database-to-azure-search-using-indexers.md)
19+
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.
2520

2621
## Prerequisites
2722

2823
* [Create a managed identity](search-howto-managed-identities-data-sources.md) for your search service.
2924

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.
3126

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).
3328

3429
## 1 - Assign permissions to read the database
3530

@@ -66,7 +61,7 @@ DROP USER IF EXISTS [insert your search service name or user-assigned managed id
6661

6762
## 2 - Add a role assignment
6863

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).
7065

7166
1. In the Azure portal, navigate to your Azure SQL Server page.
7267

@@ -98,7 +93,7 @@ The [REST API](/rest/api/searchservice/create-data-source), Azure portal, and th
9893

9994
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.
10095

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.
10297

10398
```http
10499
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
125120

126121
* 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".
127122

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:
129124

130125
```http
131126
POST https://[service name].search.windows.net/datasources?api-version=2021-04-30-preview
@@ -170,7 +165,7 @@ api-key: [admin key]
170165

171166
## 5 - Create the indexer
172167

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.
174169

175170
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.
176171

@@ -183,11 +178,11 @@ api-key: [admin key]
183178
"name" : "sql-indexer",
184179
"dataSourceName" : "sql-datasource",
185180
"targetIndexName" : "my-target-index"
186-
```
181+
```
187182

188183
## Troubleshooting
189184

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).
191186

192187
You can also rule out any firewall issues by trying the connection with and without restrictions in place.
193188

0 commit comments

Comments
 (0)