Skip to content

Commit a9c19c3

Browse files
authored
Merge pull request #49827 from jimdial/service-endpoints-tutorial
Service endpoints tutorial
2 parents 7eb7d6d + 86ab8f2 commit a9c19c3

File tree

1 file changed

+65
-64
lines changed

1 file changed

+65
-64
lines changed

articles/virtual-network/tutorial-restrict-network-access-to-resources.md

Lines changed: 65 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ms.devlang: na
1515
ms.topic: tutorial
1616
ms.tgt_pltfrm: virtual-network
1717
ms.workload: infrastructure
18-
ms.date: 03/14/2018
18+
ms.date: 08/23/2018
1919
ms.author: jdial
2020
---
2121

@@ -35,29 +35,28 @@ If you prefer, you can complete this tutorial using the [Azure CLI](tutorial-res
3535

3636
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
3737

38-
## Log in to Azure
38+
## Log in to Azure
3939

40-
Log in to the Azure portal at http://portal.azure.com.
40+
Log in to the Azure portal at https://portal.azure.com.
4141

4242
## Create a virtual network
4343

4444
1. Select **+ Create a resource** on the upper, left corner of the Azure portal.
4545
2. Select **Networking**, and then select **Virtual network**.
4646
3. Enter, or select, the following information, and then select **Create**:
4747

48-
|Setting|Value|
49-
|----|----|
50-
|Name| myVirtualNetwork |
51-
|Address space| 10.0.0.0/16|
52-
|Subscription| Select your subscription|
53-
|Resource group | Select **Create new** and enter *myResourceGroup*.|
54-
|Location| Select **East US** |
55-
|Subnet Name| Public|
56-
|Subnet Address range| 10.0.0.0/24|
57-
|Service endpoints| Disabled|
58-
59-
![Enter basic information about your virtual network](./media/tutorial-restrict-network-access-to-resources/create-virtual-network.png)
48+
|Setting|Value|
49+
|----|----|
50+
|Name| myVirtualNetwork |
51+
|Address space| 10.0.0.0/16|
52+
|Subscription| Select your subscription|
53+
|Resource group | Select **Create new** and enter *myResourceGroup*.|
54+
|Location| Select **East US** |
55+
|Subnet Name| Public|
56+
|Subnet Address range| 10.0.0.0/24|
57+
|Service endpoints| Disabled|
6058

59+
![Enter basic information about your virtual network](./media/tutorial-restrict-network-access-to-resources/create-virtual-network.png)
6160

6261
## Enable a service endpoint
6362

@@ -97,7 +96,7 @@ By default, all VMs in a subnet can communicate with all resources. You can limi
9796
4. After the network security group is created, enter *myNsgPrivate*, in the **Search resources, services, and docs** box at the top of the portal. When **myNsgPrivate** appears in the search results, select it.
9897
5. Under **SETTINGS**, select **Outbound security rules**.
9998
6. Select **+ Add**.
100-
7. Create a rule that allows outbound communication to the Azure Storage service. Enter, or select, the following information, and then select **OK**:
99+
7. Create a rule that allows outbound communication to the Azure Storage service. Enter, or select, the following information, and then select **Add**:
101100

102101
|Setting|Value|
103102
|----|----|
@@ -110,8 +109,8 @@ By default, all VMs in a subnet can communicate with all resources. You can limi
110109
|Action|Allow|
111110
|Priority|100|
112111
|Name|Allow-Storage-All|
113-
114-
8. Create a rule that denies outbound communication to the internet. This rule overrides a default rule in all network security groups that allows outbound internet communication. Complete steps 6 and 7 again, using the following values:
112+
113+
8. Create another outbound security rule that denies communication to the internet. This rule overrides a default rule in all network security groups that allows outbound internet communication. Complete steps 5-7 again, using the following values:
115114

116115
|Setting|Value|
117116
|----|----|
@@ -127,14 +126,13 @@ By default, all VMs in a subnet can communicate with all resources. You can limi
127126

128127
9. Under **SETTINGS**, select **Inbound security rules**.
129128
10. Select **+ Add**.
130-
11. Create a rule that allows Remote Desktop Protocol (RDP) traffic inbound to the subnet from anywhere. The rule overrides a default security rule that denies all inbound traffic from the internet. Remote desktop connections are allowed to the subnet so that connectivity can be tested in a later step. Complete steps 6 and 7 again, using the following values:
129+
11. Create an inbound security rule that allows Remote Desktop Protocol (RDP) traffic to the subnet from anywhere. The rule overrides a default security rule that denies all inbound traffic from the internet. Remote desktop connections are allowed to the subnet so that connectivity can be tested in a later step. Under **SETTINGS**, select **Inbound security rules**, select **+Add**, enter the following values, and then select **Add**:
131130

132131
|Setting|Value|
133132
|----|----|
134133
|Source| Any |
135134
|Source port ranges| * |
136-
|Destination | Select **Service Tag**|
137-
|Destination service tag| Select **VirtualNetwork**|
135+
|Destination | Select **VirtualNetwork**|
138136
|Destination port ranges| 3389 |
139137
|Protocol|Any|
140138
|Action|Allow|
@@ -160,18 +158,19 @@ The steps necessary to restrict network access to resources created through Azur
160158
|----|----|
161159
|Name| Enter a name that is unique across all Azure locations, between 3-24 characters in length, using only numbers and lower-case letters.|
162160
|Account kind|StorageV2 (general purpose v2)|
161+
|Location| Select **East US** |
163162
|Replication| Locally-redundant storage (LRS)|
164163
|Subscription| Select your subscription|
165164
|Resource group | Select **Use existing** and select *myResourceGroup*.|
166-
|Location| Select **East US** |
167165

168166
### Create a file share in the storage account
169167

170168
1. After the storage account is created, enter the name of the storage account in the **Search resources, services, and docs** box, at the top of the portal. When the name of your storage account appears in the search results, select it.
171169
2. Select **Files**, as shown in the following picture:
172170

173-
![Storage account](./media/tutorial-restrict-network-access-to-resources/storage-account.png)
174-
3. Select **+ File share**, under **File service**.
171+
![Storage account](./media/tutorial-restrict-network-access-to-resources/storage-account.png)
172+
173+
3. Select **+ File share**.
175174
4. Enter *my-file-share* under **Name**, and then select **OK**.
176175
5. Close the **File service** box.
177176

@@ -180,8 +179,8 @@ The steps necessary to restrict network access to resources created through Azur
180179
By default, storage accounts accept network connections from clients in any network, including the internet. Deny network access from the internet, and all other subnets in all virtual networks, except for the *Private* subnet in the *myVirtualNetwork* virtual network.
181180

182181
1. Under **SETTINGS** for the storage account, select **Firewalls and virtual networks**.
183-
2. Under **Virtual networks**, select **Selected networks**.
184-
3. Select **Add existing virtual network**.
182+
2. Select **Selected networks**.
183+
3. Select **+Add existing virtual network**.
185184
4. Under **Add networks**, select the following values, and then select **Add**:
186185

187186
|Setting|Value|
@@ -190,7 +189,7 @@ By default, storage accounts accept network connections from clients in any netw
190189
|Virtual networks|Select **myVirtualNetwork**, under **Virtual networks**|
191190
|Subnets| Select **Private**, under **Subnets**|
192191

193-
![Firewalls and virtual networks](./media/tutorial-restrict-network-access-to-resources/storage-firewalls-and-virtual-networks.png)
192+
![Firewalls and virtual networks](./media/tutorial-restrict-network-access-to-resources/storage-firewalls-and-virtual-networks.png)
194193

195194
5. Select **Save**.
196195
6. Close the **Firewalls and virtual networks** box.
@@ -208,65 +207,67 @@ To test network access to a storage account, deploy a VM to each subnet.
208207

209208
1. Select **+ Create a resource** found on the upper, left corner of the Azure portal.
210209
2. Select **Compute**, and then select **Windows Server 2016 Datacenter**.
211-
3. Enter, or select, the following information, and then select **OK**:
212-
213-
|Setting|Value|
214-
|----|----|
215-
|Name| myVmPublic|
216-
|User name|Enter a user name of your choosing.|
217-
|Password| Enter a password of your choosing. The password must be at least 12 characters long and meet the [defined complexity requirements](../virtual-machines/windows/faq.md?toc=%2fazure%2fvirtual-network%2ftoc.json#what-are-the-password-requirements-when-creating-a-vm).|
218-
|Subscription| Select your subscription.|
219-
|Resource group| Select **Use existing** and select **myResourceGroup**.|
220-
|Location| Select **East US**.|
221-
222-
![Enter basic information about a virtual machine](./media/tutorial-restrict-network-access-to-resources/virtual-machine-basics.png)
210+
3. Enter, or select, the following information and then select **OK**:
211+
212+
|Setting|Value|
213+
|----|----|
214+
|Name| myVmPublic|
215+
|User name|Enter a user name of your choosing.|
216+
|Password| Enter a password of your choosing. The password must be at least 12 characters long and meet the [defined complexity requirements](../virtual-machines/windows/faq.md?toc=%2fazure%2fvirtual-network%2ftoc.json#what-are-the-password-requirements-when-creating-a-vm).|
217+
|Subscription| Select your subscription.|
218+
|Resource group| Select **Use existing** and select **myResourceGroup**.|
219+
|Location| Select **East US**.|
220+
221+
![Enter basic information about a virtual machine](./media/tutorial-restrict-network-access-to-resources/virtual-machine-basics.png)
223222
4. Select a size for the virtual machine and then select **Select**.
224223
5. Under **Settings**, select **Network** and then select **myVirtualNetwork**. Then select **Subnet**, and select **Public**, as shown in the following picture:
225224

226-
![Select a virtual network](./media/tutorial-restrict-network-access-to-resources/virtual-machine-settings.png)
227-
6. On the **Summary** page, select **Create** to start the virtual machine deployment. The VM takes a few minutes to deploy, but you can continue to the next step while the VM is creating.
225+
![Select a virtual network](./media/tutorial-restrict-network-access-to-resources/virtual-machine-settings.png)
226+
227+
6. Under **Network Security Group**, select **Advanced**. The portal automatically creates a network security group for you that allows port 3389, which you'll need open to connect to the virtual machine in a later step. Select **OK** on the **Settings** page.
228+
7. On the **Summary** page, select **Create** to start the virtual machine deployment. The VM takes a few minutes to deploy, but you can continue to the next step while the VM is creating.
228229

229230
### Create the second virtual machine
230231

231-
Complete steps 1-6 again, but in step 3, name the virtual machine *myVmPrivate* and in step 5, select the **Private** subnet.
232+
Complete steps 1-7 again, but in step 3, name the virtual machine *myVmPrivate* and in step 5, select the **Private** subnet.
232233

233234
The VM takes a few minutes to deploy. Do not continue to the next step until it finishes creating and its settings open in the portal.
234235

235236
## Confirm access to storage account
236237

237238
1. Once the *myVmPrivate* VM finishes creating, Azure opens the settings for it. Connect to the VM by selecting the **Connect** button, as shown in the following picture:
238239

239-
![Connect to a virtual machine](./media/tutorial-restrict-network-access-to-resources/connect-to-virtual-machine.png)
240+
![Connect to a virtual machine](./media/tutorial-restrict-network-access-to-resources/connect-to-virtual-machine.png)
240241

241242
2. After selecting the **Connect** button, a Remote Desktop Protocol (.rdp) file is created and downloaded to your computer.
242243
3. Open the downloaded rdp file. If prompted, select **Connect**. Enter the user name and password you specified when creating the VM. You may need to select **More choices**, then **Use a different account**, to specify the credentials you entered when you created the VM.
243244
4. Select **OK**.
244245
5. You may receive a certificate warning during the sign-in process. If you receive the warning, select **Yes** or **Continue**, to proceed with the connection.
245246
6. On the *myVmPrivate* VM, map the Azure file share to drive Z using PowerShell. Before running the commands that follow, replace `<storage-account-key>` and `<storage-account-name>` with values you supplied and retrieved in [Create a storage account](#create-a-storage-account).
246247

247-
```powershell
248-
$acctKey = ConvertTo-SecureString -String "<storage-account-key>" -AsPlainText -Force
249-
$credential = New-Object System.Management.Automation.PSCredential -ArgumentList "Azure\<storage-account-name>", $acctKey
250-
New-PSDrive -Name Z -PSProvider FileSystem -Root "\\<storage-account-name>.file.core.windows.net\my-file-share" -Credential $credential
251-
```
252-
253-
PowerShell returns output similar to the following example output:
248+
```powershell
249+
$acctKey = ConvertTo-SecureString -String "<storage-account-key>" -AsPlainText -Force
250+
$credential = New-Object System.Management.Automation.PSCredential -ArgumentList "Azure\<storage-account-name>", $acctKey
251+
New-PSDrive -Name Z -PSProvider FileSystem -Root "\\<storage-account-name>.file.core.windows.net\my-file-share" -Credential $credential
252+
```
254253

255-
```powershell
256-
Name Used (GB) Free (GB) Provider Root
257-
---- --------- --------- -------- ----
258-
Z FileSystem \\vnt.file.core.windows.net\my-f...
259-
```
254+
PowerShell returns output similar to the following example output:
260255

261-
The Azure file share successfully mapped to the Z drive.
256+
```powershell
257+
Name Used (GB) Free (GB) Provider Root
258+
---- --------- --------- -------- ----
259+
Z FileSystem \\vnt.file.core.windows.net\my-f...
260+
```
261+
262+
The Azure file share successfully mapped to the Z drive.
262263

263264
7. Confirm that the VM has no outbound connectivity to the internet from a command prompt:
264265

265-
```
266-
ping bing.com
267-
```
268-
269-
You receive no replies, because the network security group associated to the *Private* subnet does not allow outbound access to the internet.
266+
```
267+
ping bing.com
268+
```
269+
270+
You receive no replies, because the network security group associated to the *Private* subnet does not allow outbound access to the internet.
270271

271272
8. Close the remote desktop session to the *myVmPrivate* VM.
272273

@@ -276,7 +277,7 @@ The VM takes a few minutes to deploy. Do not continue to the next step until it
276277
2. When **myVmPublic** appears in the search results, select it.
277278
3. Complete steps 1-6 in [Confirm access to storage account](#confirm-access-to-storage-account) for the *myVmPublic* VM.
278279

279-
Access is denied and you receive a `New-PSDrive : Access is denied` error. Access is denied because the *myVmPublic* VM is deployed in the *Public* subnet. The *Public* subnet does not have a service endpoint enabled for Azure Storage. The storage account only allows network access from the *Private* subnet, not the *Public* subnet.
280+
After a short wait, you receive a `New-PSDrive : Access is denied` error. Access is denied because the *myVmPublic* VM is deployed in the *Public* subnet. The *Public* subnet does not have a service endpoint enabled for Azure Storage. The storage account only allows network access from the *Private* subnet, not the *Public* subnet.
280281

281282
4. Close the remote desktop session to the *myVmPublic* VM.
282283

@@ -285,9 +286,9 @@ The VM takes a few minutes to deploy. Do not continue to the next step until it
285286
7. Select **Files**.
286287
8. You receive the error shown in the following picture:
287288

288-
![Access denied error](./media/tutorial-restrict-network-access-to-resources/access-denied-error.png)
289+
![Access denied error](./media/tutorial-restrict-network-access-to-resources/access-denied-error.png)
289290

290-
Access is denied, because your computer is not in the *Private* subnet of the *MyVirtualNetwork* virtual network.
291+
Access is denied, because your computer is not in the *Private* subnet of the *MyVirtualNetwork* virtual network.
291292

292293
## Clean up resources
293294

0 commit comments

Comments
 (0)