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/virtual-network/tutorial-restrict-network-access-to-resources.md
+65-64Lines changed: 65 additions & 64 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ ms.devlang: na
15
15
ms.topic: tutorial
16
16
ms.tgt_pltfrm: virtual-network
17
17
ms.workload: infrastructure
18
-
ms.date: 03/14/2018
18
+
ms.date: 08/23/2018
19
19
ms.author: jdial
20
20
---
21
21
@@ -35,29 +35,28 @@ If you prefer, you can complete this tutorial using the [Azure CLI](tutorial-res
35
35
36
36
If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/?WT.mc_id=A261C142F) before you begin.
37
37
38
-
## Log in to Azure
38
+
## Log in to Azure
39
39
40
-
Log in to the Azure portal at http://portal.azure.com.
40
+
Log in to the Azure portal at https://portal.azure.com.
41
41
42
42
## Create a virtual network
43
43
44
44
1. Select **+ Create a resource** on the upper, left corner of the Azure portal.
45
45
2. Select **Networking**, and then select **Virtual network**.
46
46
3. Enter, or select, the following information, and then select **Create**:
47
47
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
-

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|
60
58
59
+

61
60
62
61
## Enable a service endpoint
63
62
@@ -97,7 +96,7 @@ By default, all VMs in a subnet can communicate with all resources. You can limi
97
96
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.
98
97
5. Under **SETTINGS**, select **Outbound security rules**.
99
98
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**:
101
100
102
101
|Setting|Value|
103
102
|----|----|
@@ -110,8 +109,8 @@ By default, all VMs in a subnet can communicate with all resources. You can limi
110
109
|Action|Allow|
111
110
|Priority|100|
112
111
|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:
115
114
116
115
|Setting|Value|
117
116
|----|----|
@@ -127,14 +126,13 @@ By default, all VMs in a subnet can communicate with all resources. You can limi
127
126
128
127
9. Under **SETTINGS**, select **Inbound security rules**.
129
128
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**:
131
130
132
131
|Setting|Value|
133
132
|----|----|
134
133
|Source| Any |
135
134
|Source port ranges| * |
136
-
|Destination | Select **Service Tag**|
137
-
|Destination service tag| Select **VirtualNetwork**|
135
+
|Destination | Select **VirtualNetwork**|
138
136
|Destination port ranges| 3389 |
139
137
|Protocol|Any|
140
138
|Action|Allow|
@@ -160,18 +158,19 @@ The steps necessary to restrict network access to resources created through Azur
160
158
|----|----|
161
159
|Name| Enter a name that is unique across all Azure locations, between 3-24 characters in length, using only numbers and lower-case letters.|
162
160
|Account kind|StorageV2 (general purpose v2)|
161
+
|Location| Select **East US**|
163
162
|Replication| Locally-redundant storage (LRS)|
164
163
|Subscription| Select your subscription|
165
164
|Resource group | Select **Use existing** and select *myResourceGroup*.|
166
-
|Location| Select **East US**|
167
165
168
166
### Create a file share in the storage account
169
167
170
168
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.
171
169
2. Select **Files**, as shown in the following picture:
4. Enter *my-file-share* under **Name**, and then select **OK**.
176
175
5. Close the **File service** box.
177
176
@@ -180,8 +179,8 @@ The steps necessary to restrict network access to resources created through Azur
180
179
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.
181
180
182
181
1. Under **SETTINGS** for the storage account, select **Firewalls and virtual networks**.
4. Under **Add networks**, select the following values, and then select **Add**:
186
185
187
186
|Setting|Value|
@@ -190,7 +189,7 @@ By default, storage accounts accept network connections from clients in any netw
190
189
|Virtual networks|Select **myVirtualNetwork**, under **Virtual networks**|
191
190
|Subnets| Select **Private**, under **Subnets**|
192
191
193
-

192
+

194
193
195
194
5. Select **Save**.
196
195
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.
208
207
209
208
1. Select **+ Create a resource** found on the upper, left corner of the Azure portal.
210
209
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
-

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
+

223
222
4. Select a size for the virtual machine and then select **Select**.
224
223
5. Under **Settings**, select **Network** and then select **myVirtualNetwork**. Then select **Subnet**, and select **Public**, as shown in the following picture:
225
224
226
-

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
+

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.
228
229
229
230
### Create the second virtual machine
230
231
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.
232
233
233
234
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.
234
235
235
236
## Confirm access to storage account
236
237
237
238
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:
238
239
239
-

240
+

240
241
241
242
2. After selecting the **Connect** button, a Remote Desktop Protocol (.rdp) file is created and downloaded to your computer.
242
243
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.
243
244
4. Select **OK**.
244
245
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.
245
246
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).
New-PSDrive -Name Z -PSProvider FileSystem -Root "\\<storage-account-name>.file.core.windows.net\my-file-share" -Credential $credential
252
+
```
254
253
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:
260
255
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.
262
263
263
264
7. Confirm that the VM has no outbound connectivity to the internet from a command prompt:
264
265
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.
270
271
271
272
8. Close the remote desktop session to the *myVmPrivate* VM.
272
273
@@ -276,7 +277,7 @@ The VM takes a few minutes to deploy. Do not continue to the next step until it
276
277
2. When **myVmPublic** appears in the search results, select it.
277
278
3. Complete steps 1-6 in [Confirm access to storage account](#confirm-access-to-storage-account) for the *myVmPublic* VM.
278
279
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.
280
281
281
282
4. Close the remote desktop session to the *myVmPublic* VM.
282
283
@@ -285,9 +286,9 @@ The VM takes a few minutes to deploy. Do not continue to the next step until it
285
286
7. Select **Files**.
286
287
8. You receive the error shown in the following picture:
0 commit comments