|
| 1 | +--- |
| 2 | +title: How to connect a Cosmos DB database to a workspace |
| 3 | +description: How to connect a Cosmos DB database to a workspace |
| 4 | +services: synapse-analytics |
| 5 | +author: acomet |
| 6 | +ms.service: synapse-analytics |
| 7 | +ms.topic: quickstart |
| 8 | +ms.subservice: |
| 9 | +ms.date: 04/21/2020 |
| 10 | +ms.author: acomet |
| 11 | +ms.reviewer: jrasnick |
| 12 | +--- |
| 13 | + |
| 14 | +# Connect and access an Azure Cosmos DB database in Azure Synapse Analytics |
| 15 | + |
| 16 | +This article describes how to access an Azure Cosmos database from Azure Synapse Analytics studio. |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | +Before you connect a Cosmos DB account to your workspace, there are a few things that you need. |
| 20 | + |
| 21 | +* Have an existing Cosmos DB account or create a new account following this [quickstart](https://docs.microsoft.com/azure/cosmos-db/how-to-manage-database-account) |
| 22 | +* Have an existing Synapse workspace or create a new workspace following this [quickstart](https://docs.microsoft.com/azure/synapse-analytics/quickstart-create-workspace) |
| 23 | + |
| 24 | +## Enable Cosmos DB analytical store |
| 25 | + |
| 26 | +To run large-scale analytics into Cosmos DB without impacting your operational performance, we recommend using HTAP collections. HTAP collections can be enabled through the analytical store. Follow this [quickstart]() to enable HTAP containers. |
| 27 | + |
| 28 | +## Connect a Cosmos DB database to a Synapse workspace |
| 29 | + |
| 30 | +Connecting a Cosmos DB database is done as linked service. A Cosmos DB linked service enables users to browse and explore data, read, and write from Synapse Spark or SQL into Cosmos DB. |
| 31 | + |
| 32 | +From the Data Object Explorer, you can directly connect a Cosmos DB database by doing the following steps: |
| 33 | +1. Select ***+*** icon near Data |
| 34 | +2. Select **Connect to external data** |
| 35 | +3. Select the API that you want to connect to: SQL or MongoDB |
| 36 | +4. Select ***Continue*** |
| 37 | +5. Name the linked service. The name will be displayed in the Object Explorer and used by Synapse run-times to connect to the database and collections. We recommend using a friendly name. |
| 38 | +6. Select the **Cosmos DB account name** and **database name** |
| 39 | +7. Select ***Create*** |
| 40 | + |
| 41 | +The Cosmos DB database, should be visible under the tab **Linked** in the Cosmos DB section. You can differentiate an HTAP enabled Cosmos DB collection from an OLTP only collection with the following icons: |
| 42 | + |
| 43 | +**HTAP collection**: |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +**OLTP only collection**: |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | +## Quickly interact with code-generated actions |
| 52 | + |
| 53 | +By right-clicking into a collection, you can use the following gesture that will trigger a Spark or SQL run-time. |
| 54 | + |
| 55 | +## Next steps |
| 56 | +* [Learn what is supported between Synapse and Cosmos DB](./concept-cosmosdb-support.md) |
0 commit comments