You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use [New-AzVM](/powershell/module/az.compute/new-azvm) to create the Windows Server 2022 virtual machine.
2113
+
Use [Get-Credential](/powershell/module/microsoft.powershell.security/get-credential) to set a user name and password for the VM and store them in the `$cred` variable.
2114
2114
2115
-
```powershell
2115
+
```azurepowershell
2116
+
$cred = Get-Credential
2117
+
```
2118
+
2119
+
Use [New-AzVMConfig](/powershell/module/az.compute/new-azvmconfig) to define a VM.
2120
+
2121
+
```azurepowershell
2122
+
$vmConfigParams = @{
2123
+
VMName = "vm-spoke-2"
2124
+
VMSize = "Standard_DS4_v2"
2125
+
}
2126
+
$vmConfig = New-AzVMConfig @vmConfigParams
2127
+
```
2128
+
2129
+
Use [Set-AzVMOperatingSystem](/powershell/module/az.compute/set-azvmoperatingsystem) and [Set-AzVMSourceImage](/powershell/module/az.compute/set-azvmsourceimage) to create the rest of the VM configuration. The following example creates an Ubuntu Server virtual machine:
Use [New-AzVM](/powershell/module/az.compute/new-azvm) to create the VM. The command will generate SSH keys for the virtual machine for login. Make note of the location of the private key. The private key is needed in later steps for connecting to the virtual machine with Azure Bastion.
0 commit comments