|
| 1 | +--- |
| 2 | +title: Connect to Azure Synapse Link for Azure Cosmos DB |
| 3 | +description: How to connect an Azure Cosmos DB to a Synapse workspace with Azure Synapse Link |
| 4 | +services: synapse-analytics |
| 5 | +author: ArnoMicrosoft |
| 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 to Azure Synapse Link for Azure Cosmos DB |
| 15 | + |
| 16 | +This article describes how to access an Azure Cosmos DB database from Azure Synapse Analytics Studio with Azure Synapse Link. |
| 17 | + |
| 18 | +## Prerequisites |
| 19 | + |
| 20 | +Before you connect an Azure Cosmos DB database to your workspace, you'll need the following: |
| 21 | + |
| 22 | +* Existing Azure Cosmos DB database or create a new account following this [quickstart](https://docs.microsoft.com/azure/cosmos-db/how-to-manage-database-account) |
| 23 | +* Existing Synapse workspace or create a new workspace following this [quickstart](https://docs.microsoft.com/azure/synapse-analytics/quickstart-create-workspace) |
| 24 | + |
| 25 | +## Enable Azure Cosmos DB analytical store |
| 26 | + |
| 27 | +To run large-scale analytics into Azure Cosmos DB without impacting your operational performance, we recommend enabling Synapse Link for Azure Cosmos DB. Synapse Link brings HTAP capability to a container and built-in support in Azure Synapse. |
| 28 | + |
| 29 | +## Navigate to Synapse Studio |
| 30 | + |
| 31 | +From your Synapse workspace, select **Launch Synapse Studio**. On the Synapse Studio home page, select **Data, which will take you to the **Data Object Explorer**. |
| 32 | + |
| 33 | +## Connect an Azure Cosmos DB database to a Synapse workspace |
| 34 | + |
| 35 | +Connecting an Azure Cosmos DB database is done as a linked service. An Azure Cosmos DB linked service enables users to browse and explore data, read, and write from Synapse Spark or SQL into Azure Cosmos DB. |
| 36 | + |
| 37 | +From the Data Object Explorer, you can directly connect to an Azure Cosmos DB database by doing the following steps: |
| 38 | +1. Select ***+*** icon near Data |
| 39 | +2. Select **Connect to external data** |
| 40 | +3. Select the API that you want to connect to: SQL API or API for MongoDB |
| 41 | +4. Select ***Continue*** |
| 42 | +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 containers. We recommend using a friendly name. |
| 43 | +6. Select the **Azure Cosmos DB account name** and **database name** |
| 44 | +7. (Optional) If no region is specified, Synapse run-time operations will be routed toward the nearest region where the analytical store is enabled. However, you can set manually which region you want your users to access Azure Cosmos DB Analytical Store. Select **Additional connection properties** and then **New**. Under **Property Name**, write ***PreferredRegions*** and set the **Value** to the region you want (example: WestUS2, there is no space between words and number) |
| 45 | +8. Select ***Create*** |
| 46 | + |
| 47 | +Azure Cosmos DB databases are visible under the tab **Linked** in the Azure Cosmos DB section. With Azure Cosmos DB, you can differentiate an HTAP enabled container from an OLTP only container through the following icons: |
| 48 | + |
| 49 | +**OLTP only container**: |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | +**HTAP enabled container**: |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | +## Quickly interact with code-generated actions |
| 58 | + |
| 59 | +By right-clicking into a container, you have list of gestures that will trigger a Spark or SQL run-time. Writing into a container will happen through the Transactional Store of Azure Cosmos DB and will consume Request Units. |
| 60 | + |
| 61 | +## Next steps |
| 62 | + |
| 63 | +* [Learn what is supported between Synapse and Azure Cosmos DB](./concept-synapse-link-cosmos-db-support.md) |
| 64 | +* [Learn how to query the analytical store with Spark](./how-to-query-analytical-store-spark.md) |
0 commit comments