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/private-link/tutorial-private-endpoint-cosmosdb-portal.md
+42-61Lines changed: 42 additions & 61 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,18 @@
1
1
---
2
2
title: 'Tutorial: Connect to an Azure Cosmos account using an Azure Private endpoint'
3
3
titleSuffix: Azure Private Link
4
-
description: Get started with this tutorial using Azure Private endpoint to connect to an Azure Cosmos account privately.
4
+
description: Get started with this tutorial using Azure Private endpoint to connect to an Azure Cosmos DB account privately.
5
5
author: asudbring
6
6
ms.author: allensu
7
7
ms.service: private-link
8
8
ms.topic: tutorial
9
-
ms.date: 9/25/2020
9
+
ms.date: 06/14/2022
10
+
ms.custom: template-tutorial #Required; leave this attribute/value as-is.
10
11
---
11
12
12
13
# Tutorial: Connect to an Azure Cosmos account using an Azure Private Endpoint
13
14
14
-
Azure Private endpoint is the fundamental building block for Private Link in Azure. It enables Azure resources, like virtual machines (VMs), to communicate with Private Link resources privately.
15
+
Azure Private endpoint is the fundamental building block for Private Link in Azure. It enables Azure resources, like virtual machines (VMs), to privately and securely communicate with Private Link resources such as Azure Cosmos DB.
15
16
16
17
In this tutorial, you learn how to:
17
18
@@ -25,7 +26,7 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
25
26
26
27
## Prerequisites
27
28
28
-
* An Azure subscription
29
+
* An Azure subscription.
29
30
30
31
## Sign in to Azure
31
32
@@ -101,7 +102,8 @@ In this section, you'll create a virtual machine that will be used to test the p
|Target subresource| Leave the default **Core (SQL)**|
172
+
| Subscription | Select your Azure subscription.|
173
+
| Resource Group | Select **myResourceGroup**.|
174
+
| Location | Select **East US**.|
175
+
| Name | Enter **myPrivateEndpoint**.|
176
+
|CosmosDB sub-resource| Leave the default **Core (SQL) - Recommended**.|
176
177
|**Networking**||
177
-
| Virtual network | Select **myVNet**|
178
-
| Subnet | Select **mySubnet**|
179
-
|**Private DNS integration**|
180
-
| Integrate with private DNS zone | Leave the default **Yes**|
181
-
| Private DNS Zone | Leave the default (New) privatelink.documents.azure.com |
178
+
| Virtual network | Select **myVNet**.|
179
+
| Subnet | Select **mySubnet**.|
180
+
|**Private DNS integration**||
181
+
| Integrate with private DNS zone | Leave the default **Yes**.|
182
+
| Private DNS Zone | Leave the default **(New) privatelink.documents.azure.com**.|
182
183
183
184
7. Select **OK**.
184
185
@@ -188,30 +189,30 @@ In this section, you'll create a Cosmos DB account and configure the private end
188
189
189
190
### Add a database and a container
190
191
191
-
1. Select **Got to resource** or in the left-hand menu of the Azure portal, select **All Resources** > **mycosmosdb**.
192
+
1. Select **Go to resource**, or in the left-hand menu of the Azure portal, select **All Resources** > **mycosmosdb**.
192
193
193
194
2. In the left-hand menu, select **Data Explorer**.
194
195
195
196
3. In the **Data Explorer** window, select **New Container**.
196
197
197
-
4. In **Add Container**, enter or select the following information:
198
+
4. In **New Container**, enter or select the following information:
198
199
199
200
| Setting | Value |
200
201
| ------- | ----- |
201
-
| Database ID| Leave the default of **Create new**. </br> Enter **mydatabaseid** in the text box. |
202
-
|Throughput (400 - 100,000 RU/s) |Leave the default of **Manual**. </br> Enter **400** in the text box. |
203
-
| Container ID| Enter **mycontainerid**|
204
-
| Partition key | Enter **/mykey**|
202
+
| Database id| Leave the default of **Create new**. </br> Enter **mydatabaseid** in the box. |
203
+
|Database throughput (400 - unlimited RU/s) |Select **Manual**. </br> Enter **400** in the box. |
204
+
| Container id| Enter **mycontainerid**.|
205
+
| Partition key | Enter **/mykey**.|
205
206
206
207
5. Select **OK**.
207
208
208
-
6. In the **Settings** section of the CosmosDB account, select **Keys**.
209
+
6. In the **Settings** section of the Cosmos DB account, select **Keys**.
209
210
210
-
7. Select copy on the **PRIMARY CONNECTION STRING**.
211
+
7. Select copy on the **PRIMARY CONNECTION STRING**. A valid connection string is in the format: `AccountEndpoint=https://<cosmosdb-account-name>.documents.azure.com:443/;AccountKey=<accountKey>;`
211
212
212
213
## Test connectivity to private endpoint
213
214
214
-
In this section, you'll use the virtual machine you created in the previous step to connect to the Cosmos DB account across the private endpoint.
215
+
In this section, you'll use the virtual machine you created in the previous steps to connect to the Cosmos DB account across the private endpoint using **Azure Cosmos DB Explorer**.
215
216
216
217
1. Select **Resource groups** in the left-hand navigation pane.
217
218
@@ -221,51 +222,31 @@ In this section, you'll use the virtual machine you created in the previous step
221
222
222
223
1. On the overview page for **myVM**, select **Connect** then **Bastion**.
223
224
224
-
1. Select the blue **Use Bastion** button.
225
-
226
225
1. Enter the username and password that you entered during the virtual machine creation.
227
226
227
+
1. Select **Connect** button.
228
+
228
229
1. Open Windows PowerShell on the server after you connect.
229
230
230
-
1. Enter `nslookup <cosmosdb-account-name>.documents.azure.com` and validate the name resolution. Replace **\<cosmosdb-account-name>** with the name of the Cosmos DB account you created in the previous steps.
231
+
1. Enter `nslookup <cosmosdb-account-name>.documents.azure.com` and validate the name resolution. Replace **\<cosmosdb-account-name>** with the name of the Cosmos DB account you created in the previous steps. You'll receive a message similar to what is displayed below:
A private IP address of **10.1.0.5** is returned for the Cosmos DB account name. This address is in the subnet of the virtual network you created previously.
242
-
243
-
1. Get your Azure Cosmos DB primary connection string from portal. A valid connection string is in the format:
244
-
245
-
For SQL API accounts: `https://<accountName>.documents.azure.com:443/;AccountKey=<accountKey>;`
246
-
For Azure Cosmos DB API for MongoDB: `mongodb://<accountName>:<accountKey>@cdbmongo36.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&retrywrites=false`
247
-
248
-
1. Install [Microsoft Azure Storage Explorer](../vs-azure-tools-storage-manage-with-storage-explorer.md?tabs=windows&toc=%2fazure%2fstorage%2fblobs%2ftoc.json) on the virtual machine.
249
-
250
-
1. Select **Finish** after the **Microsoft Azure Storage Explorer** is installed. Leave the box checked to open the application.
251
-
252
-
1. In the **Connect to Azure Storage** screen, select **Cancel**.
253
-
254
-
1. In Storage Explorer, select the right mouse button on **Cosmos DB Accounts** and select **Connect to Cosmos DB**.
242
+
A private IP address of **10.1.0.5** is returned for the Cosmos DB account name. This address is in **mySubnet** subnet of **myVNet** virtual network you created previously.
255
243
256
-
1. Leave the default of **SQL** under **Select API**.
244
+
1. Go to https://cosmos.azure.com/. Select **Connect to your account with connection string**, then paste the connection string that you copied in the previous steps and select **Connect**.
257
245
258
-
1. In the box under **Connection String**, paste the connection string from the Cosmos DB account you copied in the previous steps.
259
-
260
-
1. Select **Next**.
261
-
262
-
1. Verify the settings are correct in **Connection Summary**.
263
-
264
-
1. Select **Connect**.
246
+
1. Under the SQL API left-hand menu, you see **mydatabaseid** and **mycontainerid** that you previously created in **mycosmosdb**.
265
247
266
248
1. Close the connection to **myVM**.
267
249
268
-
269
250
## Clean up resources
270
251
271
252
If you're not going to continue to use this application, delete the virtual network, virtual machine, and Cosmos DB account with the following steps:
@@ -282,12 +263,12 @@ If you're not going to continue to use this application, delete the virtual netw
282
263
283
264
## Next steps
284
265
285
-
In this tutorial, you created a:
266
+
In this tutorial, you learned how to create:
286
267
287
268
* Virtual network and bastion host.
288
269
* Virtual Machine.
289
270
* Cosmos DB Account.
290
271
291
-
Learn how to create a Private Link service:
272
+
Learn how to connect to a web app using an Azure Private Endpoint:
292
273
> [!div class="nextstepaction"]
293
-
> [Create a Private Link service](create-private-link-service-portal.md)
274
+
> [Connect to a web app using Private Endpoint](tutorial-private-endpoint-webapp-portal.md)
0 commit comments