Commands
- az login –subscription “Study”
- az account list-locations
- az group create –name “rgstudy” –location “eastasia”
- az group list -0 table
- az network vnet create –resource-group “rgstudy” –name “vnet-rgstudy” –address-prefix “10.1.0.0/16” –subnet-name “rgstudy-subnet-1”–subnet-prefix “10.1.1.0/24”
- az network vnet list -o table
- az network public-ip create –resource-group “rgstudy” –name “rgstudy-linux-pip-1”
- az network nsg create –resource-group “rgstudy” –name “rgstudy-linux-nsg-1”
- az network nsg list -o table
- az network nic create –resource-group “rgstudy” –name “rgstudy-linux-nic-1” –vnet-name “vnet-rgstudy” –subnet “rgstudy-subnet-1” –network-security-group “rgstudy-linux-nsg-1” –public-ip-address “rgstudy-linux-pip-1”
- az network nic list -o table
- ssh-keygen -m PEM -t rsa -b 4096
- az vm image list -o table
- az vm create –resource-group “rgstudy” –location “eastasia” –name “rgstudy-vm-linux-1” –nics “rgstudy-linux-nic-1” –image “RHEL” –admin-username “demoadmin” –authentication-type “ssh” –ssh-key-value ~/.ssh/id_rsa.pub
- az vm open-port –resource-group “rgstudy” –name “rgstudy-vm-linux-1” –port “22”
-
az vm list-ip-addresses –name “rgstudy-vm-linux-1” –output table
To Create Windows VM, we can use same resource group and existing vnet
- we’re going to place this server in the existing resource group.
- we’re going to place this server in the same vnet
- az network public-ip create –resource-group “rgstudy” –name “rgstudy-win-1-pip-1”
- az network nsg create –resource-group “rgstudy” –name “rgstudy-win-nsg-1”
- az network nic create –resource-group “rgstudy” –name “rgstudy-win-1-nic-1” –vnet-name “vnet-rgstudy” –subnet “rgstudy-subnet-1” –network-security-group “rgstudy-win-nsg-1” –public-ip-address “rgstudy-win-1-pip-1”
- az vm create –resource-group “rgstudy” –name “rgstudy-win-1” –location “eastasia” –nics “rgstudy-win-1-nic-1” –image “win2016datacenter” –admin-username “sls-admin” –admin-password “VFBnwLTX8ufnHuRTAjt5”
- az vm open-port –port “3389” –resource-group “rgstudy” –name “rgstudy-win-1”
- az vm list-ip-addresses –name “rgstudy-win-1” –output table
https://docs.microsoft.com/en-us/cli/azure/?view=azure-cli-latest
https://docs.microsoft.com/en-us/cli/azure/format-output-azure-cli?view=azure-cli-latest