Skip to content

Commit 4563186

Browse files
committed
fixes
1 parent 84391cb commit 4563186

File tree

1 file changed

+35
-8
lines changed

1 file changed

+35
-8
lines changed

articles/virtual-network/tutorial-connect-virtual-networks-portal.md

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -260,29 +260,47 @@ Repeat the previous steps to create a second virtual machine in the second virtu
260260
Create a VM with [New-AzVM](/powershell/module/az.compute/new-azvm). The following example creates a VM named **vm-1** in the **vnet-1** virtual network. The `-AsJob` option creates the VM in the background, so you can continue to the next step. When prompted, enter the user name and password for the virtual machine.
261261

262262
```azurepowershell-interactive
263-
$vm1 = @{
263+
# Create a credential object
264+
$cred = Get-Credential
265+
266+
# Define the VM parameters
267+
$vmParams = @{
264268
ResourceGroupName = "test-rg"
265269
Location = "EastUS2"
270+
Name = "vm-1"
271+
ImageName = "Canonical:ubuntu-24_04-lts:server-gen1:latest"
272+
Size = "Standard_DS1_v2"
273+
Credential = $cred
266274
VirtualNetworkName = "vnet-1"
267275
SubnetName = "subnet-1"
268-
ImageName = "Win2019Datacenter"
269-
Name = "vm-1"
276+
PublicIpAddressName = $null # No public IP address
270277
}
271-
New-AzVm @vm1 -AsJob
278+
279+
# Create the VM
280+
New-AzVM @vmParams
272281
```
273282

274283
### Create the second VM
275284

276285
```azurepowershell-interactive
277-
$vm2 = @{
286+
# Create a credential object
287+
$cred = Get-Credential
288+
289+
# Define the VM parameters
290+
$vmParams = @{
278291
ResourceGroupName = "test-rg"
279292
Location = "EastUS2"
293+
Name = "vm-2"
294+
ImageName = "Canonical:ubuntu-24_04-lts:server-gen1:latest"
295+
Size = "Standard_DS1_v2"
296+
Credential = $cred
280297
VirtualNetworkName = "vnet-2"
281298
SubnetName = "subnet-1"
282-
ImageName = "Win2019Datacenter"
283-
Name = "vm-2"
299+
PublicIpAddressName = $null # No public IP address
284300
}
285-
New-AzVm @vm2
301+
302+
# Create the VM
303+
New-AzVM @vmParams
286304
```
287305

288306
The VM takes a few minutes to create. Don't continue with the later steps until Azure creates **vm-2** and returns output to PowerShell.
@@ -349,6 +367,15 @@ Use `ping` to test the communication between the virtual machines.
349367
350368
### [PowerShell](#tab/powershell)
351369
370+
When no longer needed, use [Remove-AzResourcegroup](/powershell/module/az.resources/remove-azresourcegroup) to remove the resource group and all of the resources it contains.
371+
372+
```azurepowershell-interactive
373+
$rgParams = @{
374+
Name = "test-rg"
375+
}
376+
Remove-AzResourceGroup @rgParams -Force
377+
```
378+
352379
### [CLI](#tab/cli)
353380

354381
---

0 commit comments

Comments
 (0)