az vm repair
Note
This reference is part of the vm-repair extension for the Azure CLI (version 2.0.67 or higher). The extension will automatically install the first time you run an az vm repair command. Learn more about extensions.
Auto repair commands to fix VMs.
VM repair command will enable Azure users to self-repair non-bootable VMs by copying the source VM's OS disk and attaching it to a newly created repair VM.
Commands
| az vm repair create |
Create a new repair VM and attach the source VM's copied OS disk as a data disk. |
| az vm repair list-scripts |
List available scripts. Located https://github.com/Azure/repair-script-library. |
| az vm repair reset-nic |
Reset the network interface stack on the VM guest OS. https://docs.microsoft.com/en-us/troubleshoot/azure/virtual-machines/reset-network-interface. |
| az vm repair restore |
Replace source VM's OS disk with data disk from repair VM. |
| az vm repair run |
Run verified scripts from GitHub on a VM. 'az vm repair list-scripts' to view available scripts. |
az vm repair create
Create a new repair VM and attach the source VM's copied OS disk as a data disk.
az vm repair create --name
--resource-group
[--associate-public-ip]
[--copy-disk-name]
[--distro]
[--enable-nested]
[--repair-group-name]
[--repair-password]
[--repair-username]
[--repair-vm-name]
[--unlock-encrypted-vm]
[--yes]
Examples
Create a repair VM
az vm repair create -g MyResourceGroup -n myVM --verbose
Create a repair VM and set the VM authentication
az vm repair create -g MyResourceGroup -n myVM --repair-username username --repair-password password!234 --verbose
Create a repair VM of a specific distro or a specific URN could also be provided
az vm repair create -g MyResourceGroup -n myVM --distro 'rhel7|sles12|ubuntu20|centos6|oracle8|sles15'
Required Parameters
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Optional Parameters
Option to create repair vm with public ip.
Name of OS disk copy.
Option to create repair vm from a specific linux distro (rhel7|rhel8|suse12|ubuntu20|centos7|oracle7).
Enable nested hyperv.
Repair resource group name.
Admin password for the repair VM.
Admin username for repair VM.
Name of repair VM.
Option to auto-unlock encrypted VMs using current subscription auth.
Option to skip prompt for associating public ip and confirm yes to it in no Tty mode.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az vm repair list-scripts
List available scripts. Located https://github.com/Azure/repair-script-library.
az vm repair list-scripts [--preview]
Examples
List scripts
az vm repair list-scripts --verbose
List windows scripts only.
az vm repair list-scripts --query "[?starts_with(id, 'win')]"
List scripts with test in its description.
az vm repair list-scripts --query "[?contains(description, 'test')]"
List unverified script from your fork of https://github.com/Azure/repair-script-library
az vm repair list-scripts --preview "https://github.com/haagha/repair-script-library/blob/master/map.json"
Optional Parameters
URL of forked repair script library's map.json https://github.com/{user}/repair-script-library/blob/master/map.json.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az vm repair reset-nic
Reset the network interface stack on the VM guest OS. https://docs.microsoft.com/en-us/troubleshoot/azure/virtual-machines/reset-network-interface.
az vm repair reset-nic --name
--resource-group
[--yes]
Examples
Reset the VM guest NIC. Specify VM resource group and name.
az vm repair reset-nic -g MyResourceGroup -n MyVM --verbose
Reset the VM guest NIC. Specify subscription id, VM resource group and name.
az vm repair reset-nic -g MyResourceGroup -n MyVM --subscription mySub --verbose
Reset the VM guest NIC and auto-start the VM if it is not in running state.
az vm repair reset-nic -g MyResourceGroup -n MyVM --yes --verbose
Required Parameters
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Optional Parameters
Do not prompt for confirmation to start VM if it is not running.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az vm repair restore
Replace source VM's OS disk with data disk from repair VM.
az vm repair restore --name
--resource-group
[--disk-name]
[--repair-vm-id]
[--yes]
Examples
Restore from the repair VM, command will auto-search for repair-vm
az vm repair restore -g MyResourceGroup -n MyVM --verbose
Restore from the repair VM, specify the disk to restore
az vm repair restore -g MyResourceGroup -n MyVM --disk-name MyDiskCopy --verbose
Required Parameters
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Optional Parameters
Name of fixed data disk. Defaults to the first data disk in the repair VM.
Repair VM resource id.
Deletes the repair resources without confirmation.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
az vm repair run
Run verified scripts from GitHub on a VM. 'az vm repair list-scripts' to view available scripts.
az vm repair run --name
--resource-group
[--custom-script-file]
[--parameters]
[--preview]
[--repair-vm-id]
[--run-id]
[--run-on-repair]
Examples
Run the script with <run-id> directly on the VM.
az vm repair run -g MyResourceGroup -n MySourceWinVM --run-id win-hello-world --verbose
Run the script with <run-id> on the linked repair VM.
az vm repair run -g MyResourceGroup -n MySourceWinVM --run-id win-hello-world --run-on-repair --verbose
Run a script with parameters on the VM.
az vm repair run -g MyResourceGroup -n MySourceWinVM --run-id win-hello-world --parameters hello=hi world=earth --verbose
Run a local custom script on the VM.
az vm repair run -g MyResourceGroup -n MySourceWinVM --custom-script-file ./file.ps1 --verbose
Run unverified script from your fork of https://github.com/Azure/repair-script-library
az vm repair run -g MyResourceGroup -n MySourceWinVM --preview "https://github.com/haagha/repair-script-library/blob/master/map.json" --run-id test
Required Parameters
The name of the Virtual Machine. You can configure the default using az configure --defaults vm=<name>.
Name of resource group. You can configure the default group using az configure --defaults group=<name>.
Optional Parameters
Custom script file to run on VM. Script should be PowerShell for windows, Bash for Linux.
Space-separated parameters in the format of '[name=]value'. Positional for bash scripts.
URL of forked repair script library's map.json https://github.com/{user}/repair-script-library/blob/master/map.json.
Repair VM resource id.
Unique run id for run scripts.
Script will be run on the linked repair VM.
Increase logging verbosity to show all debug logs.
Show this help message and exit.
Only show errors, suppressing warnings.
Output format.
JMESPath query string. See http://jmespath.org/ for more information and examples.
Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.
Increase logging verbosity. Use --debug for full debug logs.
Feedback
Submit and view feedback for