Dev/Test Lab virtual machines - az lab vm

Commands to manage VM in a DevTest Lab.

Commands

az lab vm apply-artifacts Command to apply artifacts to virtual machine in Azure DevTest Lab.
az lab vm claim Claim a specific virtual machine or any available from the Lab.
az lab vm create Command to create VM in a DevTest Lab.
az lab vm delete Delete virtual machine.
az lab vm list Command to retrieve my vms from the Azure DevTest Lab.
az lab vm show Get virtual machine.
az lab vm start Start a virtual machine.
az lab vm stop Stop a virtual machine This operation can take a while to complete.

az lab vm apply-artifacts

Command to apply artifacts to virtual machine in Azure DevTest Lab.

az lab vm apply-artifacts --lab-name
--name
--resource-group
[--artifacts]

Required Parameters

--lab-name

Name of the Lab.

--name -n

Name of the virtual machine.

--resource-group -g

Name of lab's resource group.

Optional Parameters

--artifacts

JSON encoded array of artifacts to be applied. Use @{file} to load from a file.

az lab vm claim

Claim a specific virtual machine or any available from the Lab.

az lab vm claim [--lab-name]
[--name]
[--resource-group]

Examples

Claim any available virtual machine in the lab.

az lab vm claim -g MyRG --lab-name MyLab

Claim a specific virtual machine in the lab.

az lab vm claim -g MyRG --lab-name MyLab --name MyVM

Claim multiple virtual machines in the lab using --ids.

az lab vm claim --ids /subscriptions/{SubID}/resourcegroups/{MyRG}/providers/microsoft.devtestlab/labs/{MyLab}/virtualmachines/{MyVM1} /subscriptions/{SubID}/resourcegroups/{MyRG}/providers/microsoft.devtestlab/labs/{MyLab}/virtualmachines/{MyVM2}

Optional Parameters

--lab-name

Name of the Lab.

--name -n

Name of the virtual machine.

--resource-group -g

Name of lab's resource group.

az lab vm create

Command to create VM in a DevTest Lab.

az lab vm create --lab-name
--name
--resource-group
[--admin-password]
[--admin-username]
[--allow-claim]
[--artifacts]
[--authentication-type]
[--disk-type]
[--expiration-date]
[--formula]
[--generate-ssh-keys]
[--image]
[--image-type]
[--ip-configuration]
[--notes]
[--saved-secret]
[--size]
[--ssh-key]
[--subnet]
[--tags]
[--vnet-name]

Examples

Create a Virtual Machine in the lab from gallery image.

az lab vm create --lab-name MyLab -g MyRG --name MyVM --image "Ubuntu Server 16.04 LTS" --image-type gallery --size Standard_DS1_v2

Create a Virtual Machine in the lab from gallery image with ssh authentication.

az lab vm create --lab-name MyLab -g MyRG --name MyVM --image "Ubuntu Server 16.04 LTS" --image-type gallery --size Standard_DS1_v2 --authentication-type ssh

Create a claimable Virtual Machine in the lab from gallery image with password authentication.

az lab vm create --lab-name MyLab -g MyRG --name MyVM --image "Ubuntu Server 16.04 LTS" --image-type gallery --size Standard_DS1_v2 --allow-claim

Create a windows Virtual Machine in the lab from gallery image with password authentication.

az lab vm create --lab-name MyLab -g MyRG --name MyVM --image "Windows Server 2008 R2 SP1" --image-type gallery --size Standard_DS1_v2

Create a Virtual Machine in the lab from custom image.

az lab vm create --lab-name MyLab -g MyRG --name MyVM --image "jenkins_custom" --image-type custom --size Standard_DS1_v2

Create a Virtual Machine in the lab with public ip configuration.

az lab vm create --lab-name MyLab -g MyRG --name MyVM --image "Ubuntu Server 16.04 LTS" --image-type gallery --size Standard_DS1_v2 --ip-configuration public

Create a Virtual Machine from a formula.

az lab vm create --lab-name MyLab -g MyRG --name MyVM --formula MyFormula --artifacts @/artifacts.json

Required Parameters

--lab-name

Name of the Lab.

--name -n

Name of the virtual machine.

--resource-group -g

Name of lab's resource group. You can configure the default group using 'az configure --defaults group='.

Optional Parameters

--admin-password

Password for the VM.

--admin-username

Username for the VM.

default value: appveyor
--allow-claim

Flag indicating whether the VM will be created as a claimable VM in the lab.

--artifacts

JSON encoded array of artifacts to be applied. Use @{file} to load from a file.

--authentication-type

Type of authentication to use with the VM. Allowed values are password, ssh.

default value: password
--disk-type

Storage type to use for virtual machine (i.e. Standard, Premium).

--expiration-date

The expiration date in UTC(YYYY-mm-dd) for VM. Ex. 2017-03-25.

--formula

Name of the formula. Use az lab formula list for available formulas. Use az lab formula with --export-artifacts flag to export & update artifacts then supply it via --artifacts argument.

--generate-ssh-keys

Generate SSH public and private key files if missing.

--image

The name of the operating system image (Gallery Image Name and Custom Image Name/ID). Use az lab gallery-image list for available Gallery Images or Use az lab custom-image list for available Custom Images.

--image-type

Type of the image. Allowed values are gallery, custom.

--ip-configuration

Type of ip configuration to use with the VM. Allowed values are shared, public, private. If omitted, will be selected based on selected vnet.

--notes

Notes for the virtual machine.

--saved-secret

Name of the saved secret to be used for authentication. When provided, we'll use it inplace of --admin-password for password based authentication or inplace of --ssh-key for ssh based authentication.

--size

The VM size to be created. See https://azure.microsoft.com/en-us/pricing/details/virtual-machines/ for size info. Required when creating VM from gallery or custom image.

--ssh-key

The SSH public key or public key file path. Use --generate-ssh-keys to regen ssh keys.

--subnet

Name of the subnet to reference an existing one in lab. If omitted, lab's existing one subnet will be selected automatically.

--tags

Space separated tags in 'key[=value]' format. Use "" to clear existing tags.

--vnet-name

Name of the virtual network to reference an existing one in lab. If omitted, lab's existing one VNet and subnet will be selected automatically.

az lab vm delete

This operation can take a while to complete.

az lab vm delete --lab-name
--name
--resource-group

Required Parameters

--lab-name

The name of the lab.

--name

The name of the virtual machine.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

az lab vm list

Command to retrieve my vms from the Azure DevTest Lab.

az lab vm list --lab-name
--resource-group
[--all]
[--claimable]
[--environment]
[--expand]
[--filters]
[--object-id]
[--order-by]
[--top]

Required Parameters

--lab-name

Name of the Lab.

--resource-group -g

Name of lab's resource group. You can configure the default group using 'az configure --defaults group='.

Optional Parameters

--all

List all virtual machines in the lab. Cannot be used with --filters.

--claimable

List of claimable virtual machines in the lab. Cannot be used with --filters.

--environment

Name or ID of the environment to list all virtual machines in the environment. Cannot be used with --filters.

--expand

Specify the expand query.

--filters

The filter to apply on the operation.

--object-id

Owner's object id. If omitted, we'll pick one if available.

--order-by

The ordering expression for the results using OData notation.

--top

The maximum number of resources to return from the operation.

az lab vm show

Get virtual machine.

az lab vm show --lab-name
--name
--resource-group
[--expand]

Required Parameters

--lab-name

The name of the lab.

--name

The name of the virtual machine.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

Optional Parameters

--expand

Specify the $expand query. Example: 'properties($expand=artifacts,computeVm,networkInterface,applicableSchedule)'.

az lab vm start

This operation can take a while to complete.

az lab vm start --lab-name
--name
--resource-group

Required Parameters

--lab-name

The name of the lab.

--name

The name of the virtual machine.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.

az lab vm stop

Stop a virtual machine This operation can take a while to complete.

az lab vm stop --lab-name
--name
--resource-group

Required Parameters

--lab-name

The name of the lab.

--name

The name of the virtual machine.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=.