Skip to content

Instantly share code, notes, and snippets.

@kpatnayakuni
Created February 3, 2020 13:43
Show Gist options
  • Save kpatnayakuni/58fe2963b4d31a6079363ec5cddfa393 to your computer and use it in GitHub Desktop.
Save kpatnayakuni/58fe2963b4d31a6079363ec5cddfa393 to your computer and use it in GitHub Desktop.
# Create a Resource Group
$rgName = 'Test-RG'
$location = 'westus'
$null = New-AzResourceGroup -Name $rgName -Location $location
# Create a Virtual Machine
$vmName = 'Test-VM'
$userName = 'sysadmin'
$plainTextPassword = 'P@ssw0rd!'
$securePassword = $plainTextPassword | ConvertTo-SecureString -AsPlainText -Force
$credential = [pscredential]::new($userName, $securePassword)
$vm = New-AzVM -ResourceGroupName $rgName -Name $vmName `
-Location $location -Credential $credential
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment