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
+24-27Lines changed: 24 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,7 +193,7 @@ Azure Bastion uses your browser to connect to VMs in your virtual network over S
193
193
VirtualNetworkName = 'vnet-1'
194
194
Sku = 'Basic'
195
195
}
196
-
New-AzBastion @bastion
196
+
New-AzBastion @bastion -AsJob
197
197
```
198
198
199
199
It takes about 10 minutes to deploy the Bastion resources. You can create VMs in the next section while Bastion deploys to your virtual network.
@@ -269,14 +269,14 @@ By default, all virtual machine instances in a subnet can communicate with any r
269
269
270
270
1. Create a network security group with [New-AzNetworkSecurityGroup](/powershell/module/az.network/new-aznetworksecuritygroup). The following example creates a network security group named *nsg-private*.
271
271
272
-
```azurepowershell-interactive
273
-
$nsgpriv = @{
274
-
ResourceGroupName = 'test-rg'
275
-
Location = 'westus2'
276
-
Name = 'nsg-private'
277
-
}
278
-
$nsg = New-AzNetworkSecurityGroup @nsgpriv
279
-
```
272
+
```azurepowershell-interactive
273
+
$nsgpriv = @{
274
+
ResourceGroupName = 'test-rg'
275
+
Location = 'westus2'
276
+
Name = 'nsg-private'
277
+
}
278
+
$nsg = New-AzNetworkSecurityGroup @nsgpriv
279
+
```
280
280
281
281
### [CLI](#tab/cli)
282
282
@@ -406,7 +406,6 @@ az network nsg create \
406
406
# Add the new rules to the security group
407
407
$nsg.SecurityRules += $rule1
408
408
$nsg.SecurityRules += $rule2
409
-
$nsg.SecurityRules += $rule3
410
409
411
410
# Update the network security group with the new rules
@@ -597,13 +596,21 @@ The steps necessary to restrict network access to resources created through Azur
597
596
1. Create a context for your storage account and key with [New-AzStorageContext](/powershell/module/az.storage/new-AzStoragecontext). The context encapsulates the storage account name and account key:
@@ -737,7 +743,7 @@ To test network access to a storage account, deploy a virtual machine to each su
737
743
738
744
### Create the first virtual machine
739
745
740
-
Create a virtual machine in the *subnet-public* subnet with [New-AzVM](/powershell/module/az.compute/new-azvm). When running the command that follows, you are prompted for credentials. The values that you enter are configured as the user name and password for the VM. The `-AsJob` option creates the VM in the background, so that you can continue to the next step.
746
+
Create a virtual machine in the *subnet-public* subnet with [New-AzVM](/powershell/module/az.compute/new-azvm). When running the command that follows, you are prompted for credentials. The values that you enter are configured as the user name and password for the VM.
741
747
742
748
```azurepowershell-interactive
743
749
$vm1 = @{
@@ -748,15 +754,7 @@ $vm1 = @{
748
754
Name = "vm-public"
749
755
PublicIpAddressName = $null
750
756
}
751
-
New-AzVm @vm1 -AsJob
752
-
```
753
-
754
-
Output similar to the following example output is returned:
755
-
756
-
```output
757
-
Id Name PSJobTypeName State HasMoreData Location Command
1 Long Running... AzureLongRun... Running True localhost New-AzVM
757
+
New-AzVm @vm1
760
758
```
761
759
762
760
### Create the second virtual machine
@@ -914,7 +912,7 @@ The virtual machine you created earlier that is assigned to the **subnet-private
914
912
915
913
1. Select **vm-private**.
916
914
917
-
1. Select **Bastion** in **Operations**.
915
+
1. Select **Connect** then **Connect via Bastion** in **Overview**.
918
916
919
917
1. Enter the username and password you specified when creating the virtual machine. Select **Connect**.
920
918
@@ -1125,7 +1123,6 @@ SSH into the *vm-private* VM.
1125
1123
Context = $storageContext
1126
1124
}
1127
1125
Get-AzStorageFile @storage
1128
-
1129
1126
```
1130
1127
1131
1128
Access is denied, and you receive a *Get-AzStorageFile : The remote server returned an error: (403) Forbidden. HTTP Status Code: 403 - HTTP Error Message: This request is not authorized to perform this operation* error, because your computer is not in the *subnet-private* subnet of the *vnet-1* virtual network.
0 commit comments