-
Login to your account using device code
az login --use-device-code
-
Check available subscriptions
az account subscription list
-
Check default subscription you have active
az account list -o table
-
Change subscription if necessary
az account set --subscription $subNameOrId
-
Create a resource group
$rgName="rg-win-vm-cli"$location="westus"az group create -n $rgName -l $location
-
Create virtual machine
$vmName="vm-win-cli"$vmImage="win2019datacenter"$adminUsername="pkolosov"$adminPassword="$env:AD_TEST_USER_PASSWORD"az vm create -g $rgName -n $vmName --image $vmImage --admin-username $adminUsername --admin-password $adminPassword
-
Open RDP for remote access
$port="3389"az vm open-port -g $rgName -n $vmName --port $port
-
Get the IP Addresses for Remote Access
az vm list-ip-addresses -g $rgName -n $vmName -o table
- Go to
Search -> Remote Desktop Connectionon your PC
- Clicking
ConnectchooseUse different accountand provide your login and password you created VM with
- Approve connection
az group delete -n $rgName --yes
