VM users - az vm user

Manage a user account on a VM.

Commands

az vm user delete Remove a user(not supported on Windows VM).
az vm user reset-ssh Reset the SSH configuration on a VM.
az vm user update Update or Add(only on Linux VM) users.

az vm user delete

Delete a user account from a VM without logging into it.

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

Examples

Delete a user account.

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

Delete User by VM Ids

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

Required Parameters

--name -n

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

--resource-group -g

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

--username -u

The user name.

Optional Parameters

--no-wait

Do not wait for the long running operation to finish.

az vm user reset-ssh

The extension will restart the SSH server, open the SSH port on your VM, and reset the SSH configuration to default values. The user account (name, password, or SSH keys) are not changed.

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

Examples

Reset the SSH configuration.

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

Reset SSH by VM Ids

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

Required Parameters

--name -n

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

--resource-group -g

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

Optional Parameters

--no-wait

Do not wait for the long running operation to finish.

az vm user update

Update a user account.

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

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="">

Set Linux User by VM Ids

az vm user update -u username --ssh-key-value "$(< ~/.ssh/id_rsa.pub)"="" --ids="" $(az="" vm="" list="" -g="" myresourcegroup="" --query="" "[].id"="" -o="">

Required Parameters

--name -n

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

--resource-group -g

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

--username -u

The user name.

Optional Parameters

--no-wait

Do not wait for the long running operation to finish.

--password -p

The user password.

--ssh-key-value

SSH public key file value or public key file path.