Create azure virtual machine with azure cloud shell

    Azure virtual machine with Azure cloud shell

To create azure virtual machine with azure cloud shell:

az vm create --resource-group RG20 --name "VM1" --image Win2022AzureEditionCore --public-ip-sku Standard   --admin-username "m3652u"


We specified the resource-group, the name of the image, the image version, if we need public-ip, (We can see in the output that a public ip has been assigned to this VM) the admin username to access the VM.)

As you can see that the password must meet specific requirements.

To see more details, about the vm , use "az vm show", below is an example:

az vm  show  --name  "VM1" --resource-group "RG20"

it is required to specify the resource-group. By executing the above command, you will see all details for the VM. (vm size, storage, network, image type...)

To see if a VM is running or not, use the command below

az vm get-instance-view --name "VM1" --resource-group "RG20"







As you can see in the output: PowerState/running, display status "VM running"

To stop the VM with azure cloud shell, use the command below:

az vm stop --name "VM1" --resource-group "RG20"




If we run again the  command:

az vm get-instance-view --name "VM1" --resource-group "RG20"

You will see that the VM has been stopped






To start the VM:

az vm start --name "VM1" --resource-group "RG20"

To delete an Azure VM:

az vm delete --name "VM1" --resource-group "RG20



If the VM had public-ip address assigned, once you delete the VM, the public-ip-address will not be deleted (it will be only un-assigned from the VM). So if you don't need the public ip address, you better delete it.

For more information about our services, visit 
We hope this article was helpfull, and we would like to thank you for viewing

Comments

Popular posts from this blog

Resource Groups with Azure cloud shell

Azure Virtual Network with Azure cloud shell