az vm user

Manage user accounts for a VM.

Commands

az vm user delete Delete a user account from a VM.
az vm user reset-ssh Reset the SSH configuration on a VM.
az vm user update Update a user account.

az vm user delete

Delete a user account from a VM.

az vm user delete --username
[--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]

Examples

Delete a user account.

az vm user delete -u username -n MyVm -g MyResourceGroup

Delete a user on all VMs in a resource group.

az vm user delete -u username --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)

Required Parameters

--username -u

The user name.

Optional Parameters

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--name -n

The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>.

--no-wait

Do not wait for the long-running operation to finish.

--resource-group -g

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

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az vm user reset-ssh

Reset the SSH configuration on a VM.

az vm user reset-ssh [--ids]
[--name]
[--no-wait]
[--resource-group]
[--subscription]

Examples

Reset the SSH configuration.

az vm user reset-ssh -n MyVm -g MyResourceGroup

Reset the SSH server on all VMs in a resource group.

az vm user reset-ssh --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)

Optional Parameters

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--name -n

The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>.

--no-wait

Do not wait for the long-running operation to finish.

--resource-group -g

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

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

az vm user update

Update a user account.

az vm user update --username
[--ids]
[--name]
[--no-wait]
[--password]
[--resource-group]
[--ssh-key-value]
[--subscription]

Examples

Update a Windows user account.

az vm user update -u username -p password -n MyVm -g MyResourceGroup

Update a Linux user account.

az vm user update -u username --ssh-key-value "$({ ~/.ssh/id_rsa.pub)" -n MyVm -g MyResourceGroup

Update a user on all VMs in a resource group.

az vm user update -u username --ssh-key-value "$({ ~/.ssh/id_rsa.pub)" --ids $(az vm list -g MyResourceGroup --query "[].id" -o tsv)

Required Parameters

--username -u

The user name.

Optional Parameters

--ids

One or more resource IDs (space-delimited). If provided, no other 'Resource Id' arguments should be specified.

--name -n

The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>.

--no-wait

Do not wait for the long-running operation to finish.

--password -p

The user password.

--resource-group -g

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

--ssh-key-value

SSH public key file value or public key file path.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.