Skip to content

Commit c9629b3

Browse files
authored
Merge pull request #249893 from asudbring/vnet-pl-sql
Update of Private endpoint tutorial for SQL server for new vnet create experience in portal
2 parents d0f3264 + a7ea63e commit c9629b3

File tree

1 file changed

+71
-194
lines changed

1 file changed

+71
-194
lines changed

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

Lines changed: 71 additions & 194 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ services: private-link
55
author: asudbring
66
ms.service: private-link
77
ms.topic: tutorial
8-
ms.date: 06/22/2022
8+
ms.date: 08/30/2023
99
ms.author: allensu
1010
ms.custom: template-tutorial, fasttrack-edit, template-tutorial
1111
# 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.
@@ -33,178 +33,57 @@ If you don't have an Azure subscription, create a [free account](https://azure.m
3333

3434
Sign in to the [Azure portal](https://portal.azure.com).
3535

36-
## Create a virtual network and bastion host
36+
[!INCLUDE [virtual-network-create-with-bastion.md](../../includes/virtual-network-create-with-bastion.md)]
3737

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 **Create new**. </br> Enter **CreateSQLEndpointTutorial** in **Name**. </br> Select **OK**. |
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**, enter 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 **(US) East US**. |
105-
| Availability Options | Select **No infrastructure redundancy required**. |
106-
| Security type | Select **Standard**. |
107-
| Image | Select **Windows Server 2019 Datacenter - Gen2**. |
108-
| Azure Spot instance | Select **No**. |
109-
| Size | Choose VM size or take default setting. |
110-
| **Administrator account** | |
111-
| Username | Enter a username. |
112-
| Password | Enter a password. |
113-
| Confirm password | Reenter password. |
114-
115-
3. Select the **Networking** tab, or select **Next: Disks**, then **Next: Networking**.
116-
117-
4. In the **Networking** tab, enter or select this information:
118-
119-
| Setting | Value |
120-
|-|-|
121-
| **Network interface** | |
122-
| Virtual network | Select **myVNet**. |
123-
| Subnet | Select **mySubnet**. |
124-
| Public IP | Select **None**. |
125-
| NIC network security group | Select **Basic**. |
126-
| Public inbound ports | Select **None**. |
127-
128-
5. Select **Review + create**.
129-
130-
6. Review the settings, and then select **Create**.
131-
132-
[!INCLUDE [ephemeral-ip-note.md](../../includes/ephemeral-ip-note.md)]
38+
[!INCLUDE [create-test-virtual-machine-linux.md](../../includes/create-test-virtual-machine-linux.md)]
13339

13440
## <a name ="create-a-private-endpoint"></a>Create an Azure SQL server and private endpoint
13541

136-
In this section, you'll create a SQL server in Azure.
137-
138-
1. On the upper-left side of the screen in the Azure portal, select **Create a resource** > **Databases** > **SQL database**.
139-
140-
1. In the **Basics** tab of **Create SQL database**, enter or select this information:
42+
In this section, you create a SQL server in Azure.
14143

142-
| Setting | Value |
143-
| ------- | ----- |
144-
| **Project details** | |
145-
| Subscription | Select your subscription. |
146-
| Resource group | Select **CreateSQLEndpointTutorial**. You created this resource group in the previous section.|
147-
| **Database details** | |
148-
| Database name | Enter **mysqldatabase**. |
149-
| Server | Select **Create new**. |
150-
151-
1. In **Create SQL Database Server**, enter or select this information:
44+
1. In the search box at the top of the portal, enter **SQL**. Select **SQL databases** in the search results.
15245

153-
| Setting | Value |
154-
| ------- | ----- |
155-
| **Server details** | |
156-
| Server name | Enter **mysqlserver**. If this name is taken, create a unique name.|
157-
| Location | Select **(US) East US**. |
158-
| **Authentication** | |
159-
| Authentication method | Select **Use SQL authentication**. |
160-
| Server admin login | Enter an administrator name of your choosing. |
161-
| Password | Enter a password of your choosing. The password must be at least eight characters long and meet the defined requirements. |
162-
| Confirm password | Reenter password. |
163-
164-
1. Select **OK**.
46+
1. In **SQL databases**, select **+ Create**.
16547

166-
1. In the **Basics** tab, enter or select this information after creating the SQL database server:
48+
1. In the **Basics** tab of **Create SQL Database**, enter or select the following information:
16749

16850
| Setting | Value |
169-
| ------- | ----- |
51+
|---|---|
52+
| **Project details** | |
53+
| Subscription | Select your subscription. |
54+
| Resource group | Select **test-rg**. |
17055
| **Database details** | |
171-
| Want to use SQL elastic pool? | Select **No**. |
172-
| Compute + Storage | Take default settings or select **Configure database** to configure compute and storage settings. |
56+
| Database name | Enter **sql-db**. |
57+
| Server | Select **Create new**. </br> Enter **sql-server-1** in **Server name** (Server names must be unique, replace **sql-server-1** with a unique value). </br> Select **(US) East US 2** in **Location**. </br> Select **Use SQL authentication**. </br> Enter a server admin sign-in and password. </br> Select **OK**. |
58+
| Want to use SQL elastic pool? | Select **No**. |
59+
| Workload environment | Leave the default of **Production**. |
17360
| **Backup storage redundancy** | |
174-
| Backup storage redundancy | Select **Locally-redundant backup storage**. |
175-
176-
:::image type="content" source="./media/tutorial-private-endpoint-sql-portal/create-sql-database-basics-tab-inline.png" alt-text="Screenshot of Create S Q L Database page showing the settings used." lightbox="./media/tutorial-private-endpoint-sql-portal/create-sql-database-basics-tab-expanded.png":::
61+
| Backup storage redundancy | Select **Locally redundant backup storage**. |
17762

178-
1. Select the **Networking** tab or select the **Next: Networking** button.
63+
1. Select **Next: Networking**.
17964

180-
1. In the **Networking** tab, enter or select this information:
65+
1. In the **Networking** tab of **Create SQL Database**, enter or select the following information:
18166

18267
| Setting | Value |
183-
| ------- | ----- |
184-
| **Network connectivity** | |
68+
|---|---|
69+
| **Network connectivity** | |
18570
| Connectivity method | Select **Private endpoint**. |
186-
187-
1. Select **+ Add private endpoint** in **Private endpoints**.
188-
189-
1. In **Create private endpoint**, enter or select this information:
190-
191-
| Setting | Value |
192-
| ------- | ----- |
71+
| **Private endpoints** | |
72+
| Select **+Add private endpoint**. | |
73+
| **Create private endpoint** | |
19374
| Subscription | Select your subscription. |
194-
| Resource group | Select **CreateSQLEndpointTutorial**. |
195-
| Location | Select **East US**. |
196-
| Name | Enter **myPrivateSQLendpoint**. |
197-
| Target sub-resource | Select **SqlServer**. |
75+
| Resource group | Select **test-rg**. |
76+
| Location | Select **East US 2**. |
77+
| Name | Enter **private-endpoint-sql**. |
78+
| Target subresource | Select **SqlServer**. |
19879
| **Networking** | |
199-
| Virtual network | Select **myVNet**. |
200-
| Subnet | Select **mySubnet**. |
201-
| **Private DNS integration** | |
202-
| Integrate with private DNS zone | Leave the default **Yes**. |
203-
| Private DNS Zone | Leave the default **(New) privatelink.database.windows.net**. |
204-
205-
1. Select **OK**.
80+
| Virtual network | Select **vnet-1**. |
81+
| Subnet | Select **subnet-1**. |
82+
| **Private DNS integration** | |
83+
| Integrate with private DNS zone | Select **Yes**. |
84+
| Private DNS zone | Leave the default of **privatelink.database.windows.net**. |
20685

207-
:::image type="content" source="./media/tutorial-private-endpoint-sql-portal/create-private-endpoint-sql-inline.png" alt-text="Screenshot of Create private endpoint page showing the settings used." lightbox="./media/tutorial-private-endpoint-sql-portal/create-private-endpoint-sql-expanded.png":::
86+
1. Select **OK**.
20887

20988
1. Select **Review + create**.
21089

@@ -214,78 +93,76 @@ In this section, you'll create a SQL server in Azure.
21493
> When adding a Private endpoint connection, public routing to your Azure SQL server is not blocked by default. The setting "Deny public network access" under the "Firewall and virtual networks" blade is left unchecked by default. To disable public network access ensure this is checked.
21594
21695
## Disable public access to Azure SQL logical server
96+
21797
For this scenario, assume you would like to disable all public access to your Azure SQL server, and only allow connections from your virtual network.
21898

219-
1. In the Azure portal search box, enter **mysqlserver** or the server name you entered in the previous steps.
220-
2. On the **Networking** page, select **Public access** tab, then select **Disable** for **Public network access**.
99+
1. In the search box at the top of the portal, enter **SQL server**. Select **SQL servers** in the search results.
221100

222-
:::image type="content" source="./media/tutorial-private-endpoint-sql-portal/disable-sql-server-public-access-inline.png" alt-text="Screenshot of the S Q L server Networking page showing how to disable public access." lightbox="./media/tutorial-private-endpoint-sql-portal/disable-sql-server-public-access-expanded.png":::
101+
1. Select **sql-server-1**.
102+
103+
1. On the **Networking** page, select **Public access** tab, then select **Disable** for **Public network access**.
223104

224-
3. Select **Save**.
105+
1. Select **Save**.
225106

226107
## Test connectivity to private endpoint
227108

228-
In this section, you'll use the virtual machine you created in the previous steps to connect to the SQL server across the private endpoint.
109+
In this section, you use the virtual machine you created in the previous steps to connect to the SQL server across the private endpoint.
229110

230-
1. Select **Resource groups** in the left-hand navigation pane.
111+
1. In the search box at the top of the portal, enter **Virtual machine**. Select **Virtual machines** in the search results.
231112

232-
2. Select **CreateSQLEndpointTutorial**.
113+
1. Select **vm-1**.
233114

234-
3. Select **myVM**.
115+
1. In **Operations** select **Bastion**.
235116

236-
4. On the overview page for **myVM**, select **Connect** then **Bastion**.
117+
1. Enter the username and password for the virtual machine.
237118

238-
5. Enter the username and password that you entered during the virtual machine creation.
119+
1. Select **Connect**.
239120

240-
6. Select **Connect** button.
121+
1. To verify name resolution of the private endpoint, enter the following command in the terminal window:
241122

242-
7. Open Windows PowerShell on the server after you connect.
123+
```bash
124+
nslookup sql-server-1.database.windows.net
125+
```
243126

244-
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:
127+
You receive a message similar to the following example. The IP address returned is the private IP address of the private endpoint.
245128

246-
```powershell
247-
Server: UnKnown
248-
Address: 168.63.129.16
129+
```output
130+
Server: 127.0.0.53
131+
Address: 127.0.0.53#53
249132
250133
Non-authoritative answer:
251-
Name: mysqlserver.privatelink.database.windows.net
252-
Address: 10.1.0.5
253-
Aliases: mysqlserver.database.windows.net
134+
sql-server-8675.database.windows.netcanonical name = sql-server-8675.privatelink.database.windows.net.
135+
Name:sql-server-8675.privatelink.database.windows.net
136+
Address: 10.1.0.4
254137
```
255-
A private IP address of **10.1.0.5** is returned for the SQL server name. This address is in **mySubnet** subnet of **myVNet** virtual network you created previously.
256138

257-
9. Install [SQL Server Management Studio](/sql/ssms/download-sql-server-management-studio-ssms?preserve-view=true&view=sql-server-2017) on **myVM**.
139+
1. Install the SQL server command line tools from [Install the SQL Server command-line tools sqlcmd and bcp on Linux](/sql/linux/sql-server-linux-setup-tools). Proceed with the next steps after the installation is complete.
258140

259-
10. Open **SQL Server Management Studio**.
141+
1. Use the following commands to connect to the SQL server you created in the previous steps.
260142

261-
4. In **Connect to server**, enter or select this information:
143+
* Replace **\<server-admin>** with the admin username you entered during the SQL server creation.
262144

263-
| Setting | Value |
264-
| ------- | ----- |
265-
| Server type | Select **Database Engine**.|
266-
| Server name | Enter **\<sqlserver-name>.database.windows.net**. |
267-
| Authentication | Select **SQL Server Authentication**. |
268-
| User name | Enter the username you entered during server creation. |
269-
| Password | Enter the password you entered during server creation. |
270-
| Remember password | Select **Yes**. |
145+
* Replace **\<admin-password>** with the admin password you entered during SQL server creation.
271146

272-
1. Select **Connect**.
273-
2. Browse databases from left menu.
274-
3. (Optionally) Create or query information from **mysqldatabase**.
275-
4. Close the remote desktop connection to **myVM**.
147+
* Replace **sql-server-1** with the name of your SQL server.
148+
149+
```bash
150+
sqlcmd -S sql-server-1.database.windows.net -U '<server-admin>' -P '<admin-password>'
151+
```
152+
153+
1. A SQL command prompt is displayed on successful sign in. Enter **exit** to exit the **sqlcmd** tool.
276154

277-
## Clean up resources
278-
When you're done using the private endpoint, SQL server, and the VM, delete the resource group and all of the resources it contains:
279-
1. Enter **CreateSQLEndpointTutorial** in the **Search** box at the top of the portal and select **CreateSQLEndpointTutorial** from the search results.
280-
2. Select **Delete resource group**.
281-
3. Enter *CreateSQLEndpointTutorial* for **TYPE THE RESOURCE GROUP NAME** and select **Delete**.
155+
156+
[!INCLUDE [portal-clean-up.md](../../includes/portal-clean-up.md)]
282157

283158
## Next steps
284159

285160
In this tutorial, you learned how to create:
286161

287162
* Virtual network and bastion host.
163+
288164
* Virtual machine.
165+
289166
* Azure SQL server with private endpoint.
290167

291168
You used the virtual machine to test connectivity privately and securely to the SQL server across the private endpoint.

0 commit comments

Comments
 (0)