Skip to content

Commit 913c423

Browse files
authored
Merge pull request #201474 from halkazwini/pl-tut-cosmos
Private Endpoint: Tutorial Freshness Review: Connect to an Azure Cosmos account using an Azure Private Endpoint
2 parents db64a3c + 36af82c commit 913c423

File tree

1 file changed

+42
-61
lines changed

1 file changed

+42
-61
lines changed

articles/private-link/tutorial-private-endpoint-cosmosdb-portal.md

Lines changed: 42 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
---
22
title: 'Tutorial: Connect to an Azure Cosmos account using an Azure Private endpoint'
33
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.
55
author: asudbring
66
ms.author: allensu
77
ms.service: private-link
88
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.
1011
---
1112

1213
# Tutorial: Connect to an Azure Cosmos account using an Azure Private Endpoint
1314

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

1617
In this tutorial, you learn how to:
1718

@@ -25,7 +26,7 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
2526

2627
## Prerequisites
2728

28-
* An Azure subscription
29+
* An Azure subscription.
2930

3031
## Sign in to Azure
3132

@@ -101,7 +102,8 @@ In this section, you'll create a virtual machine that will be used to test the p
101102
| Virtual machine name | Enter **myVM** |
102103
| Region | Select **East US** |
103104
| Availability Options | Select **No infrastructure redundancy required** |
104-
| Image | Select **Windows Server 2019 Datacenter - Gen1** |
105+
| Security type | Select **Standard** |
106+
| Image | Select **Windows Server 2019 Datacenter - Gen2** |
105107
| Azure Spot instance | Select **No** |
106108
| Size | Choose VM size or take default setting |
107109
| **Administrator account** | |
@@ -132,7 +134,9 @@ In this section, you'll create a virtual machine that will be used to test the p
132134

133135
In this section, you'll create a Cosmos DB account and configure the private endpoint.
134136

135-
1. In the left-hand menu, select **Create a resource** > **Databases** > **Cosmos DB Account**, or search for **Cosmos DB account** in the search box.
137+
1. In the left-hand menu, select **Create a resource** > **Databases** > **Azure Cosmos DB**, or search for **Azure Cosmos DB** in the search box.
138+
139+
2. In **Select API option** page, Select **Create** under **Core (SQL)**.
136140

137141
2. In the **Basics** tab of **Create Cosmos DB account** enter or select the following information:
138142

@@ -143,14 +147,11 @@ In this section, you'll create a Cosmos DB account and configure the private end
143147
| Resource Group | Select **myResourceGroup**. |
144148
| **Instance details** | |
145149
| Account name | Enter **mycosmosdb**. If the name is unavailable, enter a unique name. |
146-
| API | Select **Core (SQL)**. |
147-
| Location | Select **East US**. |
150+
| Location | Select **(US) East US**. |
148151
| Capacity mode | Leave the default **Provisioned throughput**. |
149152
| Apply Free Tier Discount | Leave the default **Do Not Apply**. |
150-
| Geo-Redundancy | Leave the default **Disable**. |
151-
| Multi-region Writes | Leave the default **Disable**. |
152153

153-
3. Select the **Networking** tab or select the **Next: Networking** button.
154+
3. Select the **Networking** tab, or select **Next: Global Distribution**, then **Next: Networking**.
154155

155156
4. In the **Networking** tab, enter or select the following information:
156157

@@ -168,17 +169,17 @@ In this section, you'll create a Cosmos DB account and configure the private end
168169

169170
| Setting | Value |
170171
|-----------------------|----------------------------------|
171-
| Subscription | Select your Azure subscription |
172-
| Resource Group | Select **myResourceGroup** |
173-
| Location | Select **East US** |
174-
| Name | Enter **myPrivateEndpoint** |
175-
| 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**. |
176177
| **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**. |
182183

183184
7. Select **OK**.
184185

@@ -188,30 +189,30 @@ In this section, you'll create a Cosmos DB account and configure the private end
188189

189190
### Add a database and a container
190191

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**.
192193

193194
2. In the left-hand menu, select **Data Explorer**.
194195

195196
3. In the **Data Explorer** window, select **New Container**.
196197

197-
4. In **Add Container**, enter or select the following information:
198+
4. In **New Container**, enter or select the following information:
198199

199200
| Setting | Value |
200201
| ------- | ----- |
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**. |
205206

206207
5. Select **OK**.
207208

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**.
209210

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>;`
211212

212213
## Test connectivity to private endpoint
213214

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**.
215216

216217
1. Select **Resource groups** in the left-hand navigation pane.
217218

@@ -221,51 +222,31 @@ In this section, you'll use the virtual machine you created in the previous step
221222

222223
1. On the overview page for **myVM**, select **Connect** then **Bastion**.
223224

224-
1. Select the blue **Use Bastion** button.
225-
226225
1. Enter the username and password that you entered during the virtual machine creation.
227226

227+
1. Select **Connect** button.
228+
228229
1. Open Windows PowerShell on the server after you connect.
229230

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

232233
```powershell
233234
Server: UnKnown
234235
Address: 168.63.129.16
235236
236237
Non-authoritative answer:
237-
Name: mycosmosdb8675.privatelink.documents.azure.com
238+
Name: mycosmosdb.privatelink.documents.azure.com
238239
Address: 10.1.0.5
239-
Aliases: mycosmosdb8675.documents.azure.com
240+
Aliases: mycosmosdb.documents.azure.com
240241
```
241-
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.
255243
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**.
257245
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**.
265247
266248
1. Close the connection to **myVM**.
267249
268-
269250
## Clean up resources
270251
271252
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
282263
283264
## Next steps
284265
285-
In this tutorial, you created a:
266+
In this tutorial, you learned how to create:
286267
287268
* Virtual network and bastion host.
288269
* Virtual Machine.
289270
* Cosmos DB Account.
290271
291-
Learn how to create a Private Link service:
272+
Learn how to connect to a web app using an Azure Private Endpoint:
292273
> [!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

Comments
 (0)