Skip to content

azure ⚓︎

Resources

Azure VMs⚓︎

Set up a spot Windows Server 2019 VM with the Azure Powershell Module⚓︎

  • Install and import the Azure Az Powershell module in the current session
    Install-Module -Name Az -Force -Verbose
    Import-Module -Name Az
    
  • Connect to your Azure subscription using the browser
    Connect-AzAccount
    
  • Create the Resource Group and the VM; remember to set the $region and the $user variables. The password is prompted interactively.
    $ResourceGroup = 'dev-test'
    $region = 'westeurope'
    $passwd = ConvertTo-SecureString $(Read-Host "Password") -AsPlainText -Force
    $Credential = New-Object System.Management.Automation.PSCredential ($user, $passwd);
    # Create resource group
    New-AzResourceGroup -Name $ResourceGroup -Location $region -Verbose
    # Create VM
    New-AzVM -ResourceGroupName $ResourceGroup -Location $region -Name $ResourceGroup -Image Win2019Datacenter -Credential $Credential -Priority Spot -Verbose