Skip to content

Commit 1609337

Browse files
authored
Merge pull request #134806 from asudbring/privlink-sqltutorial
Private Link endpoint SQL tutorial for the portal
2 parents 5091f93 + fc8620e commit 1609337

File tree

2 files changed

+268
-1
lines changed

2 files changed

+268
-1
lines changed

articles/private-link/toc.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
href: tutorial-private-endpoint-cosmosdb-portal.md
3434
- name: Connect to a web app
3535
href: tutorial-private-endpoint-webapp-portal.md
36+
- name: SQL
37+
items:
38+
- name: Connect to a SQL server - Portal
39+
href: tutorial-private-endpoint-sql-portal.md
3640
- name: Concepts
3741
items:
3842
- name: Private Endpoint
@@ -89,7 +93,7 @@
8993
- name: Database for PostgreSQL
9094
href: ../postgresql/concepts-data-access-and-security-private-link.md?toc=%2fazure%2fprivate-link%2ftoc.json
9195
- name: SQL
92-
href: ../azure-sql/database/private-endpoint-overview.md?toc=%2fazure%2fprivate-link%2ftoc.json
96+
href: tutorial-private-endpoint-sql-portal.md
9397
- name: Developer Tools
9498
items:
9599
- name: App Configuration
Lines changed: 263 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,263 @@
1+
---
2+
3+
title: 'Tutorial - Connect to an Azure SQL server using an Azure Private Endpoint'
4+
description: Use this tutorial to learn how to create a Azure SQL server with a private endpoint.
5+
services: private-link
6+
author: asudbring
7+
# Customer intent: As someone with a basic network background, but is new to Azure, I want to create a private endpoint on a SQL server so that I can securely connect to it.
8+
ms.service: private-link
9+
ms.topic: tutorial
10+
ms.date: 10/20/2020
11+
ms.author: allensu
12+
13+
---
14+
15+
# Tutorial - Connect to an Azure SQL server using an Azure Private Endpoint
16+
17+
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.
18+
19+
In this tutorial, you learn how to:
20+
21+
> [!div class="checklist"]
22+
> * Create a virtual network and bastion host.
23+
> * Create a virtual machine.
24+
> * Create a Azure SQL server and private endpoint.
25+
> * Test connectivity to the SQL server private endpoint.
26+
27+
## Prerequisites
28+
29+
* An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
30+
31+
## Sign in to Azure
32+
33+
Sign in to the Azure portal at https://portal.azure.com.
34+
35+
36+
## Create a virtual network and bastion host
37+
38+
In this section, you'll create a virtual network, subnet, and bastion host.
39+
40+
The bastion host will be used to connect securely to the virtual machine for testing the private endpoint.
41+
42+
1. On the upper-left side of the screen, select **Create a resource > Networking > Virtual network** or search for **Virtual network** in the search box.
43+
44+
2. In **Create virtual network**, enter or select this information in the **Basics** tab:
45+
46+
| **Setting** | **Value** |
47+
|------------------|-----------------------------------------------------------------|
48+
| **Project Details** | |
49+
| Subscription | Select your Azure subscription |
50+
| Resource Group | Select **CreateSQLEndpointTutorial-rg** |
51+
| **Instance details** | |
52+
| Name | Enter **myVNet** |
53+
| Region | Select **East US** |
54+
55+
3. Select the **IP Addresses** tab or select the **Next: IP Addresses** button at the bottom of the page.
56+
57+
4. In the **IP Addresses** tab, enter this information:
58+
59+
| Setting | Value |
60+
|--------------------|----------------------------|
61+
| IPv4 address space | Enter **10.1.0.0/16** |
62+
63+
5. Under **Subnet name**, select the word **default**.
64+
65+
6. In **Edit subnet**, enter this information:
66+
67+
| Setting | Value |
68+
|--------------------|----------------------------|
69+
| Subnet name | Enter **mySubnet** |
70+
| Subnet address range | Enter **10.1.0.0/24** |
71+
72+
7. Select **Save**.
73+
74+
8. Select the **Security** tab.
75+
76+
9. Under **BastionHost**, select **Enable**. Enter this information:
77+
78+
| Setting | Value |
79+
|--------------------|----------------------------|
80+
| Bastion name | Enter **myBastionHost** |
81+
| AzureBastionSubnet address space | Enter **10.1.1.0/24** |
82+
| Public IP Address | Select **Create new**. </br> For **Name**, enter **myBastionIP**. </br> Select **OK**. |
83+
84+
85+
8. Select the **Review + create** tab or select the **Review + create** button.
86+
87+
9. Select **Create**.
88+
89+
## Create a virtual machine
90+
91+
In this section, you'll create a virtual machine that will be used to test the private endpoint.
92+
93+
1. On the upper-left side of the portal, select **Create a resource** > **Compute** > **Virtual machine** or search for **Virtual machine** in the search box.
94+
95+
2. In **Create a virtual machine**, type or select the values in the **Basics** tab:
96+
97+
| Setting | Value |
98+
|-----------------------|----------------------------------|
99+
| **Project Details** | |
100+
| Subscription | Select your Azure subscription |
101+
| Resource Group | Select **CreateSQLEndpointTutorial** |
102+
| **Instance details** | |
103+
| Virtual machine name | Enter **myVM** |
104+
| Region | Select **East US** |
105+
| Availability Options | Select **No infrastructure redundancy required** |
106+
| Image | Select **Windows Server 2019 Datacenter - Gen1** |
107+
| Azure Spot instance | Select **No** |
108+
| Size | Choose VM size or take default setting |
109+
| **Administrator account** | |
110+
| Username | Enter a username |
111+
| Password | Enter a password |
112+
| Confirm password | Reenter password |
113+
114+
3. Select the **Networking** tab, or select **Next: Disks**, then **Next: Networking**.
115+
116+
4. In the Networking tab, select or enter:
117+
118+
| Setting | Value |
119+
|-|-|
120+
| **Network interface** | |
121+
| Virtual network | **myVNet** |
122+
| Subnet | **mySubnet** |
123+
| Public IP | Select **None**. |
124+
| NIC network security group | **Basic**|
125+
| Public inbound ports | Select **None**. |
126+
127+
5. Select **Review + create**.
128+
129+
6. Review the settings, and then select **Create**.
130+
131+
## <a name ="create-a-private-endpoint"></a>Create an Azure SQL server and private endpoint
132+
133+
In this section, you'll create a SQL server in Azure.
134+
135+
1. On the upper-left side of the screen in the Azure portal, select **Create a resource** > **Databases** > **SQL database**.
136+
137+
1. In the **Basics** tab of **Create SQL database**, enter, or select this information:
138+
139+
| Setting | Value |
140+
| ------- | ----- |
141+
| **Project details** | |
142+
| Subscription | Select your subscription. |
143+
| Resource group | Select **CreateSQLEndpointTutorial**. You created this resource group in the previous section.|
144+
| **Database details** | |
145+
| Database name | Enter **mysqldatabase**. If this name is taken, create a unique name. |
146+
| Server | Select **Create new**. |
147+
148+
6. In **New server**, enter or select this information:
149+
150+
| Setting | Value |
151+
| ------- | ----- |
152+
| Server name | Enter **mysqlserver**. If this name is taken, create a unique name.|
153+
| Server admin login | Enter an administrator name of your choosing. |
154+
| Password | Enter a password of your choosing. The password must be at least 8 characters long and meet the defined requirements. |
155+
| Location | Select **East US** |
156+
157+
7. Select **OK**.
158+
159+
8. Select the **Networking** tab or select the **Next: Networking** button.
160+
161+
9. In the **Networking** tab, enter or select this information:
162+
163+
| Setting | Value |
164+
| ------- | ----- |
165+
| **Network connectivity** | |
166+
| Connectivity method | Select **Private endpoint**. |
167+
168+
10. Select **+ Add private endpoint** in **Private endpoints**.
169+
170+
11. In **Create private endpoint**, enter or select this information:
171+
172+
| Setting | Value |
173+
| ------- | ----- |
174+
| Subscription | Select your subscription. |
175+
| Resource group | Select **CreateSQLEndpointTutorial**. |
176+
| Location | Select **East US**. |
177+
| Name | Enter **myPrivateSQLendpoint**. |
178+
| Target sub-resource | Select **SQLServer**. |
179+
| **Networking** | |
180+
| Virtual network | Select **myVNet**. |
181+
| Subnet | Select **mySubnet**. |
182+
| **Private DNS integration** | |
183+
| Integrate with private DNS zone | Leave the default **Yes**. |
184+
| Private DNS Zone | Leave the default **(New) privatelink.database.windows.net**. |
185+
186+
12. Select **OK**.
187+
188+
13. Select **Review + create**.
189+
190+
14. Select **Create**.
191+
192+
## Test connectivity to private endpoint
193+
194+
In this section, you'll use the virtual machine you created in the previous step to connect to the SQL server across the private endpoint.
195+
196+
1. Select **Resource groups** in the left-hand navigation pane.
197+
198+
2. Select **CreateSQLEndpointTutorial**.
199+
200+
3. Select **myVM**.
201+
202+
4. On the overview page for **myVM**, select **Connect** then **Bastion**.
203+
204+
5. Select the blue **Use Bastion** button.
205+
206+
6. Enter the username and password that you entered during the virtual machine creation.
207+
208+
7. Open Windows PowerShell on the server after you connect.
209+
210+
8. Enter `nslookup <sqlserver-name>.database.windows.net`. Replace **\<sqlserver-name>** with the name of the SQL server you created in the previous steps. You'll receive a message similar to what is displayed below:
211+
212+
```powershell
213+
Server: UnKnown
214+
Address: 168.63.129.16
215+
216+
Non-authoritative answer:
217+
Name: mysqlserver8675.privatelink.database.windows.net
218+
Address: 10.1.0.5
219+
Aliases: mysqlserver8675.database.windows.net
220+
```
221+
222+
A private IP address of **10.1.0.5** is returned for the SQL server name. This address is in the subnet of the virtual network you created previously.
223+
224+
225+
9. Install [SQL Server Management Studio](https://docs.microsoft.com/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-2017&preserve-view=true) on **myVM**.
226+
227+
10. Open **SQL Server Management Studio**.
228+
229+
4. In **Connect to server**, enter or select this information:
230+
231+
| Setting | Value |
232+
| ------- | ----- |
233+
| Server type | Select **Database Engine**.|
234+
| Server name | Enter **\<sqlserver-name>.database.windows.net** |
235+
| Authentication | Select **SQL Server Authentication**. |
236+
| User name | Enter the username you entered during server creation |
237+
| Password | Enter the password you entered during server creation |
238+
| Remember password | Select **Yes**. |
239+
240+
1. Select **Connect**.
241+
2. Browse databases from left menu.
242+
3. (Optionally) Create or query information from **mysqldatabase**.
243+
4. Close the remote desktop connection to **myVM**.
244+
245+
## Clean up resources
246+
When you're done using the private endpoint, SQL server, and the VM, delete the resource group and all of the resources it contains:
247+
1. Enter **CreateSQLEndpointTutorial** in the **Search** box at the top of the portal and select **CreateSQLEndpointTutorial** from the search results.
248+
2. Select **Delete resource group**.
249+
3. Enter CreateSQLEndpointTutorial for **TYPE THE RESOURCE GROUP NAME** and select **Delete**.
250+
251+
## Next steps
252+
253+
In this tutorial, you created a:
254+
255+
* Virtual network and bastion host.
256+
* Virtual machine.
257+
* Azure SQL server with private endpoint.
258+
259+
You used the virtual machine to test connectivity securely to the SQL server across the private endpoint.
260+
261+
Learn how to create a Private Link service:
262+
> [!div class="nextstepaction"]
263+
> [Create a Private Link service](create-private-link-service-portal.md)

0 commit comments

Comments
 (0)