Skip to content

Instantly share code, notes, and snippets.

@acerzhou
Last active October 25, 2020 05:33
Show Gist options
  • Save acerzhou/cb3519db5eddbdbf488686ff6998c12d to your computer and use it in GitHub Desktop.
Save acerzhou/cb3519db5eddbdbf488686ff6998c12d to your computer and use it in GitHub Desktop.
[Azure Powershell] Azure PowerShell #Azure #Powershell
$myResourceGroup = Read-Host -prompt "Enter a resource group name: "
$myLocation = Read-Host -prompt "Enter a location (ie. WestUS): "
$myVM = Read-Host -prompt "Enter a VM name: "
$vmAdmin = Read-Host -prompt "Enter a VM admin user name: "
# The password must meet the length and complexity requirements.
$vmPassword = Read-Host -prompt "Enter the admin password: "
# create a resource group
New-AzResourceGroup -Name $myResourceGroup -Location $myLocation
# Create the virtual machine. When prompted, provide a username
# and password to be used as the logon credentials for the VM.
New-AzVm `
-ResourceGroupName $myResourceGroup `
-Name $myVM `
-Location $myLocation `
-adminUsername $vmAdmin `
-adminPassword $vmPassword
New-AzResourceGroupDeployment `
-Mode Complete `
-Name ExampleDeployment `
-ResourceGroupName ExampleResourceGroup `
-TemplateFile c:\MyTemplates\storage.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment