- Update Windows Powershell as Administrator using:
Install-Module PSWindowsUpdate
- Install Azure PowerShell
- Install as Powershell Administrator:
Install-Module AzureAD
-
Let's login, may launch a browser to authenticate the session.
Connect-AzAccount -SubscriptionName 'Azure for Students'
-
Ensure you're pointed at your correct subscription
Set-AzContext -SubscriptionName 'Azure for Students'
- Create a Resource Group
$rgName="rg-win-vm-pwsh"
$location="CentralUS"
New-AzResourceGroup -Name $rgName -Location $location
$adminUsername="razumovsky_r"
$password="$env:AD_TEST_USER_PASSWORD"
$adminPassword=ConvertTo-SecureString $password -AsPlainText -Force
$psCredential = New-Object System.Management.Automation.PSCredential ($adminUsername, $adminPassword)
Note, you can create Windows or Linux VMs with PowerShell by specifying the correct Image parameter. This command does not create public IP Address
$vmName="vm-win-pwsh"
$image="Win2019Datacenter"
Get-AzVMSize -Location $location
$vmSize="Standard_B1ms"
New-AzVM -ResourceGroupName $rgName -Name $vmName -Image $image -Credential $psCredential -OpenPorts "3389" -PublicIpSku "Standard" -Size $vmSize
- Go to
Azure Portal -> VM -> Connect (top left corner) -> RDP
- Download RDP file
- Connect to VM providing username and password
Remove-AzResourceGroup -Name $rgName