-
Sign in to your Azure subscription using the steps listed in Connect to Azure from the Azure CLI 1.0.
-
Make sure you are in the Classic deployment mode as follows:
azure config mode asm
-
Find out the Linux image that you want to load from the available images as follows:
azure vm image list | grep "Linux"
In a Windows command-prompt window, use find instead of grep.
-
Use
azure vm create
to create a VM with the Linux image from the previous list. This step creates a cloud service and storage account. You could also connect this VM to an existing cloud service with a-c
option. Create an SSH endpoint to log in to the Linux virtual machine with the-e
option. The following example creates a VM namedmyVM
using theUbuntu-14_04_4-LTS
image in theWest US
location, and adds a user nameops
:azure vm create myVM \ b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_4-LTS-amd64-server-20160516-en-us-30GB \ -g ops -p P@ssw0rd! -z "Small" -e -l "West US"
The output is similar to the following example:
info: Executing command vm create + Looking up image b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04_4-LTS-amd64-server-20160516-en-us-30GB + Looking up cloud service info: cloud service myVM not found. + Creating cloud service + Retrieving storage accounts + Creating VM info: vm create command OK
[!NOTE] For a Linux virtual machine, you must provide the
-e
option invm create
. It is not possible to enable SSH after the virtual machine has been created. For more details on SSH, read How to Use SSH with Linux on Azure. -
You can verify the attributes of the VM by using the
azure vm show
command. The following example lists information for the VM namedmyVM
:azure vm show myVM
-
Start your VM with the
azure vm start
command as follows:azure vm start myVM
For details on all these Azure CLI 1.0 virtual machine commands, read the Using the Azure CLI 1.0 with the Classic deployment API.