Azure VM 생성하는 Azure CLI


참고: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/tutorial-manage-vm

1) Resource Group 생성하기
az group create –name myRG –location eastus
az group list -o table

2) VM 생성하기-기본
az vm create –resource-group myRG –name myVM1 –image UbuntuLTS –generate-ssh-keys

3) VM에 연결하기
ssh 52.174.34.95
exit

4) 사용가능한 VM 이미지 목록 확인하기
az vm image list –output table

5) 사용 가능한 모든 VM 이미지 확인하기
az vm image list –offer CentOS –all –output table
az vm image list –offer Ubuntu –all –o table

6) VM 생성하기-상세
az vm create –resource-group myRG –name myVM2 –image OpenLogic:CentOS:6.5:latest –generate-ssh-keys

7) 사용 가능한 VM 크기 확인하기
az vm list-sizes –location eastus –output table

8) 특정한 VM 크기의 VM 생성하기
az vm create –resource-group myRG –name myVM3 –image UbuntuLTS –size Standard_F4s –generate-ssh-keys

9) 현재 실행중인 VM 크기 확인하기
az vm show –resource-group myRG –name myVM1 –query hardwareProfile.vmSize

10) 변경 가능한 VM 크기 확인하기
az vm list-vm-resize-options –resource-group myRG –name myVM1 –query [].name

11) VM 크기 변경하기
az vm resize –resource-group myRG –name myVM1 –size Standard_DS4_v2

12) VM의 Power State 확인하기
az vm get-instance-view –name myVM1 –resource-group myRG –query instanceView.statuses[1] –output table

13) VM의 IP Address 확인하기
az vm list-ip-addresses –resource-group myRG –name myVM1 –output table

14) VM 멈추고 시작하기
az vm stop –resource-group myRG –name myVM1
az vm start –resource-group myRG –name myVM1

15) Resource Group 삭제하기
az group delete –name myRG –no-wait –yes

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s