Skip to content

Commit 3414932

Browse files
committed
docs: Add Get-Credential step for VM creation in PowerShell tab
1 parent 0649ed9 commit 3414932

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

articles/virtual-network/ip-services/virtual-networks-static-private-ip.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ New-AzVirtualNetwork @vnet
130130

131131
### Create a virtual machine
132132

133+
Create a credential object for the virtual machine with [Get-Credential](/powershell/module/microsoft.powershell.security/get-credential). Enter a username and password when prompted:
134+
135+
```azurepowershell-interactive
136+
$cred = Get-Credential
137+
```
138+
133139
The following command creates a Linux virtual machine without a public IP address with [New-AzVM](/powershell/module/az.compute/new-azvm). The `-GenerateSshKey` parameter generates an SSH key pair for the VM:
134140

135141
```azurepowershell-interactive
@@ -139,6 +145,7 @@ $vm = @{
139145
Location = 'East US 2'
140146
Name = 'myVM'
141147
Image = 'Ubuntu2204'
148+
Credential = $cred
142149
VirtualNetworkName = 'myVNet'
143150
SubnetName = 'default'
144151
PublicIpAddressName = ''

0 commit comments

Comments
 (0)