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/synapse-analytics/sql/query-cosmos-db-analytical-store.md
+33-21Lines changed: 33 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,50 +34,62 @@ This article explains how to write a query with a serverless SQL pool that queri
34
34
## Overview
35
35
36
36
Serverless SQL pool enables you to query Azure Cosmos DB analytical storage using `OPENROWSET` function.
37
-
-`OPENROWSET` that uses workspace managed identity to access the analytical store.
38
-
-`OPENROWSET` with inline key. This syntax can be used to query Azure Cosmos DB collections without the need to prepare credentials.
39
-
-`OPENROWSET` that references a credential that contains the Azure Cosmos DB account key. This syntax can be used to create views on Azure Cosmos DB collections.
40
-
41
-
### [OPENROWSET with key or managed identity](#tab/openrowset-key)
42
-
43
-
To support querying and analyzing data in an Azure Cosmos DB analytical store, a serverless SQL pool is used. The serverless SQL pool uses the `OPENROWSET` SQL syntax, so you must first convert your Azure Cosmos DB connection string to this format:
44
37
45
38
```sql
46
39
OPENROWSET(
47
40
'CosmosDB',
48
41
'<SQL connection string for Azure Cosmos DB>',
49
-
<Container name>
42
+
<other parameters>
50
43
) [ < with clause > ] AS alias
51
44
```
52
45
53
46
The SQL connection string for Azure Cosmos DB includes the following components:
54
-
-**Account Name** - The name of the Azure Cosmos DB account you are targeting.
55
-
-**Database Name** - The container name, specified without quotation marks in the OPENROWSET syntax. If the container name contains special characters (for example, a dash -), it should be enclosed in square brackets ([]).
56
-
-**Region Name** (optional) - The region of your CosmosDB analytical storage. If omitted, the container's primary region is used.
57
-
-**AuthType** - set this option to `ManagedIdentity` if accessing CosmosDB using the Synapse workspace Managed Identity instead of the account key.
58
-
-**Key** - The master key for accessing CosmosDB data, used if not utilizing the Synapse workspace managed identity.
59
-
-**Endpoint** (optional) - required if your CosmosDB account does not follow the standard `*.documents.azure.com` format.
47
+
-**account** - The name of the Azure Cosmos DB account you are targeting.
48
+
-**database** - The container name, specified without quotation marks in the OPENROWSET syntax. If the container name contains special characters (for example, a dash -), it should be enclosed in square brackets ([]).
49
+
-**region** (optional) - The region of your CosmosDB analytical storage. If omitted, the container's primary region is used.
50
+
-**endpoint** (optional) - required if your CosmosDB account does not follow the standard `*.documents.azure.com` format.
60
51
61
-
Some of this information can be derived from the standard Azure Cosmos DB connection string:
52
+
> [!IMPORTANT]
53
+
> The `endpoint` parameter is needed for accounts that don't match the standard `*.documents.azure.com` format. For example, if your Azure Cosmos DB account ends with `.documents.azure.us`, make sure that you add `endpoint=<account name>.documents.azure.us` in the connection string.
62
54
55
+
These properties can be identified from the standard CosmosDb connection string, for example:
- Using the workspace managed identity instead of the CosmosDB account key:
65
+
This connection string does not include the authentication information required to connect to CosmosDB analytical storage. Additional information is needed depending on the type of authentication used:
66
+
- If `OPENROWSET` uses workspace managed identity to access the analytical store, you should add the `AuthType` property.
67
+
- If `OPENROWSET` uses an inline account key, you should add the `key` property. This allows you to query Azure Cosmos DB collections without needing to prepare credentials.
68
+
- Instead of including authentication information in the connection string, `OPENROWSET` can reference a credential that contains the Azure Cosmos DB account key. This approach can be used to create views on Azure Cosmos DB collections.
69
+
70
+
These options are described below.
71
+
72
+
### [OPENROWSET with key or managed identity](#tab/openrowset-key)
73
+
74
+
To support querying and analyzing data in an Azure Cosmos DB analytical store, a serverless SQL pool is used. The serverless SQL pool uses the `OPENROWSET` SQL syntax, so you must first convert your Azure Cosmos DB connection string to this format:
In addition to the common properties in the SQL connection string that are described above (**account**, **database**, **region**, and **endpoint**), in this case, you need to add **one** of the following options:
84
+
-**AuthType** - set this option to `ManagedIdentity` if accessing CosmosDB using the Synapse workspace Managed Identity.
85
+
-**key** - The master key for accessing CosmosDB data, used if not utilizing the Synapse workspace managed identity.
77
86
78
-
> [!IMPORTANT]
79
-
> There's another optional parameter in connection string called `endpoint`. The `endpoint` param is needed for accounts that don't match the standard `*.documents.azure.com` format. For example, if your Azure Cosmos DB account ends with `.documents.azure.us`, make sure that you add `endpoint=<account name>.documents.azure.us` in the connection string.
87
+
The examples of connection strings are shown in the following table:
0 commit comments