Skip to content

Commit 6f10723

Browse files
committed
fix: Replace invalid AdminUsername with Credential parameter in New-AzVM commands
1 parent c72b701 commit 6f10723

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

articles/virtual-network/tutorial-restrict-network-access-to-resources.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -926,15 +926,16 @@ To test network access to a storage account, deploy a virtual machine to each su
926926
Create a virtual machine in the *subnet-public* subnet with [New-AzVM](/powershell/module/az.compute/new-azvm).
927927
928928
```azurepowershell-interactive
929+
$cred = New-Object System.Management.Automation.PSCredential("azureuser", (ConvertTo-SecureString " " -AsPlainText -Force))
929930
$vm1 = @{
930931
ResourceGroupName = "test-rg"
931932
Location = "westus2"
932933
VirtualNetworkName = "vnet-1"
933934
SubnetName = "subnet-public"
934935
Name = "vm-public"
935936
Image = "Ubuntu2204"
936-
AdminUsername = "azureuser"
937-
PublicIpAddressName = $null
937+
Credential = $cred
938+
PublicIpAddressName = ""
938939
GenerateSshKey = $true
939940
SshKeyName = "vm-public-key"
940941
}
@@ -953,8 +954,8 @@ $vm2 = @{
953954
SubnetName = "subnet-private"
954955
Name = "vm-private"
955956
Image = "Ubuntu2204"
956-
AdminUsername = "azureuser"
957-
PublicIpAddressName = $null
957+
Credential = $cred
958+
PublicIpAddressName = ""
958959
GenerateSshKey = $true
959960
SshKeyName = "vm-private-key"
960961
}

0 commit comments

Comments
 (0)