Skip to content

Commit 969fbb9

Browse files
committed
added azure bastion host commands to powershell
1 parent bfe9a99 commit 969fbb9

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

articles/virtual-network/tutorial-create-route-table-portal.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ $rg = @{
109109
ResourceGroupName = "test-rg"
110110
Location = "EastUS2"
111111
}
112-
113112
New-AzResourceGroup @rg
114113
```
115114

@@ -126,7 +125,7 @@ $vnet = @{
126125
$virtualNetwork = New-AzVirtualNetwork @vnet
127126
```
128127

129-
Create three subnets by creating three subnet configurations with [New-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/new-azvirtualnetworksubnetconfig). The following example creates three subnet configurations for *Public*, *Private*, and *DMZ* subnets:
128+
Create four subnets by creating four subnet configurations with [New-AzVirtualNetworkSubnetConfig](/powershell/module/az.network/new-azvirtualnetworksubnetconfig). The following example creates four subnet configurations for *Public*, *Private*, *DMZ*, and Azure Bastion subnets.
130129

131130
```azurepowershell-interactive
132131
$subnetConfigPublicParams = @{
@@ -135,19 +134,26 @@ $subnetConfigPublicParams = @{
135134
VirtualNetwork = $virtualNetwork
136135
}
137136
137+
$subnetConfigBastionParams = @{
138+
Name = "AzureBastionSubnet"
139+
AddressPrefix = "10.0.1.0/24"
140+
VirtualNetwork = $virtualNetwork
141+
}
142+
138143
$subnetConfigPrivateParams = @{
139144
Name = "subnet-private"
140-
AddressPrefix = "10.0.1.0/24"
145+
AddressPrefix = "10.0.2.0/24"
141146
VirtualNetwork = $virtualNetwork
142147
}
143148
144149
$subnetConfigDmzParams = @{
145150
Name = "subnet-dmz"
146-
AddressPrefix = "10.0.2.0/24"
151+
AddressPrefix = "10.0.3.0/24"
147152
VirtualNetwork = $virtualNetwork
148153
}
149154
150155
$subnetConfigPublic = Add-AzVirtualNetworkSubnetConfig @subnetConfigPublicParams
156+
$subnetConfigBastion = Add-AzVirtualNetworkSubnetConfig @subnetConfigBastionParams
151157
$subnetConfigPrivate = Add-AzVirtualNetworkSubnetConfig @subnetConfigPrivateParams
152158
$subnetConfigDmz = Add-AzVirtualNetworkSubnetConfig @subnetConfigDmzParams
153159
```
@@ -158,6 +164,35 @@ Write the subnet configurations to the virtual network with [Set-AzVirtualNetwor
158164
$virtualNetwork | Set-AzVirtualNetwork
159165
```
160166

167+
### Create Azure Bastion
168+
169+
Create a public IP address for the Azure Bastion host with [New-AzPublicIpAddress](/powershell/module/az.network/new-azpublicipaddress). The following example creates a public IP address named *public-ip-bastion* in the *vnet-1* virtual network.
170+
171+
```azurepowershell-interactive
172+
$publicIpParams = @{
173+
ResourceGroupName = "test-rg"
174+
Name = "public-ip-bastion"
175+
Location = "EastUS2"
176+
AllocationMethod = "Static"
177+
Sku = "Standard"
178+
}
179+
New-AzPublicIpAddress @publicIpParams
180+
```
181+
182+
Create an Azure Bastion host with [New-AzBastion](/powershell/module/az.network/new-azbastion). The following example creates an Azure Bastion host named *bastion* in the *AzureBastionSubnet* subnet of the *vnet-1* virtual network. Azure Bastion is used to securely connect Azure virtual machines without exposing them to the public internet.
183+
184+
```azurepowershell-interactive
185+
$bastionParams = @{
186+
ResourceGroupName = "test-rg"
187+
Name = "bastion"
188+
Location = "EastUS"
189+
VirtualNetworkName = "vnet-1"
190+
SubnetName = "AzureBastionSubnet"
191+
PublicIpAddressName = "public-ip-bastion"
192+
}
193+
New-AzBastion @bastionParams -AsJob
194+
```
195+
161196
### [CLI](#tab/cli)
162197

163198
---

0 commit comments

Comments
 (0)