Skip to content

Commit 7062b4b

Browse files
committed
Fix PowerShell VM creation: add credential and update image alias
1 parent 369a080 commit 7062b4b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

articles/nat-gateway/quickstart-create-nat-gateway.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,17 +343,21 @@ In this section, you create a virtual machine to test the NAT gateway and verify
343343
Create a virtual machine with [New-AzVM](/powershell/module/az.compute/new-azvm). An SSH key pair is generated during VM creation.
344344

345345
```azurepowershell-interactive
346+
$securePassword = ConvertTo-SecureString ' ' -AsPlainText -Force
347+
$cred = New-Object System.Management.Automation.PSCredential ('azureuser', $securePassword)
348+
346349
$vm = @{
347350
ResourceGroupName = 'test-rg'
348351
Location = 'eastus2'
349352
Name = 'vm-1'
350-
Image = 'Canonical:ubuntu-24_04-lts:server:latest'
353+
Image = 'Ubuntu2204'
351354
Size = 'Standard_DS1_v2'
352355
VirtualNetworkName = 'vnet-1'
353356
SubnetName = 'subnet-1'
354357
PublicIpAddressName = ''
355358
GenerateSshKey = $true
356359
SshKeyName = 'vm-1_key'
360+
Credential = $cred
357361
}
358362
New-AzVM @vm
359363
```

0 commit comments

Comments
 (0)