Skip to content

Instantly share code, notes, and snippets.

@kpatnayakuni
Last active February 3, 2020 13:41
Show Gist options
  • Select an option

  • Save kpatnayakuni/f2f5301366f541790a592dacb9e1575d to your computer and use it in GitHub Desktop.

Select an option

Save kpatnayakuni/f2f5301366f541790a592dacb9e1575d 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