Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 23 additions & 13 deletions src/vm-repair/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
Release History
===============

2.2.0
++++++
Adding `--tags` parameter to `vm repair create` and `vm repair repair-and-restore` commands to allow users to tag the repair VM for organizational requirements
Adding `--copy-tags` parameter to `vm repair create` and `vm repair repair-and-restore` commands to allow users to copy tags from the source VM to the repair VM
Adding `--size` parameter to `vm repair create` and `vm repair repair-and-restore` commands to allow users to specify the size of the repair VM
Changing the default to only create a public IP when `--associate-public-ip` flag is set
Updating Linux image list for new versions and removing EoL versions
TODO: update public docs after release to match new behaviors
TODO: remove `--yes` parameter in future release after users have adapted to new behavior

2.1.3
++++++
Fixing an issue with repair-and-restore related to the change to python3.13
Expand All @@ -17,11 +27,11 @@ Disabled trusted launch for Arm64

2.1.1
++++++
Updated README file for `vm repair` extension.
Updated README file for `vm repair` extension.

2.1.0
++++++
Added new parameter `--os-disk-type` to `vm repair create` to let users specify the repair vm's os disk storage account type.
Added new parameter `--os-disk-type` to `vm repair create` to let users specify the repair vm's os disk storage account type.

2.0.3
++++++
Expand All @@ -34,11 +44,11 @@ Updated parameter descriptions and examples for `az vm repair create`.

2.0.1
++++++
Fixed 2 Unbound variable bugs in `vm repair create` and improved the code documentation.
Fixed 2 Unbound variable bugs in `vm repair create` and improved the code documentation.

2.0.0
++++++
Changed default VM image to 2022-datacenter-smalldisk for better default security.
Changed default VM image to 2022-datacenter-smalldisk for better default security.

1.1.1
++++++
Expand All @@ -56,9 +66,9 @@ Added breaking change warning for the default image for Windows source VMs if th

1.0.9
++++++
Fixed and updated several vm-repair tests for better coverage.
Removed and updated broken image aliases pointing at images that no longer existed.
Add `--encrypt-recovery-key` string parameter to `vm repair create` to use recovery key provided by the user to unlock the disk for a confidential VM.
Fixed and updated several vm-repair tests for better coverage.
Removed and updated broken image aliases pointing at images that no longer existed.
Add `--encrypt-recovery-key` string parameter to `vm repair create` to use recovery key provided by the user to unlock the disk for a confidential VM.

1.0.8
++++++
Expand All @@ -75,7 +85,7 @@ Add CLI update wait for ASG to wait for the operation done as the async 2rd oper
1.0.5
++++++
Bug fix ASG is not added properly when reset the nic
Add ASG if exist when nic is reset
Add ASG if exist when nic is reset

1.0.4
++++++
Expand Down Expand Up @@ -139,19 +149,19 @@ Updated exsiting privateIpAddress field to privateIPAddress and privateIpAllocat

0.5.0
++++++
Support for hosting repair vm in existing resource group and fixing existing resource group logic
Support for hosting repair vm in existing resource group and fixing existing resource group logic

0.5.0
++++++
Support for hosting repair vm in existing resource group and fixing existing resource group logic
Support for hosting repair vm in existing resource group and fixing existing resource group logic

0.4.10
++++++
Support for hosting repair vm in existing resource group and fixing existing resource group logic
Support for hosting repair vm in existing resource group and fixing existing resource group logic

0.4.9
++++++
Fix for encrypted vm's auto unlock feature
Fix for encrypted vm's auto unlock feature

0.4.8
++++++
Expand Down Expand Up @@ -195,7 +205,7 @@ Add support for preview flag and fix Gen2 bug

0.3.8
++++++
Add support for optional public IP
Add support for optional public IP

0.3.6
++++++
Expand Down
35 changes: 28 additions & 7 deletions src/vm-repair/azext_vm_repair/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,33 @@
- name: Create a repair VM
text: >
az vm repair create -g MyResourceGroup -n myVM --verbose
- name: Create a repair VM with tags
text: >
az vm repair create -g MyResourceGroup -n myVM --tags "env=dev owner=alice" --verbose
- name: Create a repair VM with identical tags to the source VM
text: >
az vm repair create -g MyResourceGroup -n myVM --copy-tags --verbose
- name: Create a repair VM and set the VM authentication
text: >
az vm repair create -g MyResourceGroup -n myVM --repair-username username --repair-password password!234 --verbose
- name: Create a repair VM of a specific distro or a specific URN could also be provided
text: >
az vm repair create -g MyResourceGroup -n myVM --distro 'rhel7|sles12|ubuntu20|centos6|oracle8|sles15'
- name: Create a repair VM with a Private IP address without any pop up asking for confirmation.
- name: Create a repair VM with a Private IP address
text: >
az vm repair create -g MyResourceGroup -n myVM --yes --repair-username <username> --repair-password <password>
- name: Create a repair VM with a Public IP address without any user input.
az vm repair create -g MyResourceGroup -n myVM --repair-username <username> --repair-password <password>
- name: Create a repair VM with a Public IP address.
text: >
az vm repair create -g MyResourceGroup -n myVM --associate-public-ip --yes --repair-username <username> --repair-password <password>
az vm repair create -g MyResourceGroup -n myVM --associate-public-ip --repair-username <username> --repair-password <password>
- name: Create a repair VM with Standard Security type.
text: >
az vm repair create -g MyResourceGroup -n myVM --yes --repair-username <username> --repair-password <password> --disable-trusted-launch
az vm repair create -g MyResourceGroup -n myVM --repair-username <username> --repair-password <password> --disable-trusted-launch
- name: Create a repair VM from a source VM with an encrypted disk. The repair VM is created with the data disk unencrypted and accessible.
text: >
az vm repair create -g MyResourceGroup -n myVM --yes --repair-username <username> --repair-password <password> --unlock-encrypted-vm --encrypt-recovery-key <key>
az vm repair create -g MyResourceGroup -n myVM --repair-username <username> --repair-password <password> --unlock-encrypted-vm --encrypt-recovery-key <key>
- name: Create a repair VM with an OS Disk storage type of StandardSSD_LRS.
text: >
az vm repair create -g MyResourceGroup -n myVM --yes --repair-username <username> --repair-password <password> --os-disk-type StandardSSD_LRS
az vm repair create -g MyResourceGroup -n myVM --repair-username <username> --repair-password <password> --os-disk-type StandardSSD_LRS
"""

helps['vm repair restore'] = """
Expand Down Expand Up @@ -114,15 +120,30 @@
helps['vm repair repair-and-restore'] = """
type: command
short-summary: Repair and restore the VM.
parameters:
- name: --tags
type: string
short-summary: Space-separated tags in 'key[=value]' format. Use '' to clear existing tags.
examples:
- name: Repair and restore a VM with tags.
text: >
az vm repair repair-and-restore --name vmrepairtest --resource-group MyResourceGroup --tags env=prod owner=bob --verbose
- name: Repair and restore a VM.
text: >
az vm repair repair-and-restore --name vmrepairtest --resource-group MyResourceGroup --verbose
"""

helps['vm repair repair-button'] = """
type: command
short-summary: repair button script.
parameters:
- name: --tags
type: string
short-summary: Space-separated tags in 'key[=value]' format. Use '' to clear existing tags.
examples:
- name: repair-button with tags.
text: >
az vm repair repair-button --name vmrepairtest --resource-group MyResourceGroup --button-command fstab --tags env=test --verbose
- name: repair-button.
text: >
az vm repair repair-button --name vmrepairtest --resource-group MyResourceGroup --button-command fstab --verbose
Expand Down
18 changes: 14 additions & 4 deletions src/vm-repair/azext_vm_repair/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ def load_arguments(self, _):
c.argument('unlock_encrypted_vm', help='Option to auto-unlock encrypted VMs using current subscription auth.')
c.argument('encrypt_recovery_key', help='Option to auto-unlock encrypted VMs using provided recovery password. The \'--unlock-encrypted-vm\' parameter must be used to use this parameter.')
c.argument('enable_nested', help='enable nested hyperv.')
c.argument('associate_public_ip', help='Option to create a repair vm with a public ip. If this parameter is not used, a private ip will be made.')
c.argument('associate_public_ip', help='Option to create a repair vm with a public ip. If this parameter is not used, only a private ip will be made.')
c.argument('distro', help='Option to create repair vm from a specific linux distro (rhel7|rhel8|sles12|sles15|ubuntu20|centos7|centos8|oracle7)')
c.argument('yes', help='Option to skip prompt for associating public ip in no Tty mode')
c.argument('disable_trusted_launch', help='Option to disable Trusted Launch security type on the repair vm by setting the security type to Standard.')
c.argument('os_disk_type', help='Change the OS Disk storage type from the default of PremiumSSD_LRS to the given value.')
c.argument('tags', help='Quoted string with space-separated key-value pairs in "key=value" format. Will be appended to the tags required for repair resources.')
c.argument('copy_tags', help='Copy tags from the source VM to the repair VM and its resources. Can be combined with --tags.')
c.argument('size', help='The size of the repair VM to create. If not specified, a size matching the source VM will be used.')
c.argument('yes', help='Deprecated - Creates the repair VM without confirmation. No current behavior change, this parameter will be removed in a future release.')

with self.argument_context('vm repair restore') as c:
c.argument('repair_vm_id', help='Repair VM resource id.')
Expand All @@ -48,10 +51,10 @@ def load_arguments(self, _):
c.argument('custom_script_file', help='Custom script file to run on VM. Script should be PowerShell for windows, Bash for Linux.')
c.argument('parameters', nargs='+', help="Space-separated parameters in the format of '[name=]value'. Positional for bash scripts. To avoid splitting on =, use the prefix \'++\' to send the entire string.")
c.argument('run_on_repair', help="Script will be run on the linked repair VM.")
c.argument('preview', help="URL of forked repair script library's map.json https://github.com/{user}/repair-script-library/blob/master/map.json")
c.argument('preview', help="URL of forked repair script library map.json https://github.com/{user}/repair-script-library/blob/master/map.json")

with self.argument_context('vm repair list-scripts') as c:
c.argument('preview', help="URL of forked repair script library's map.json https://github.com/{user}/repair-script-library/blob/master/map.json")
c.argument('preview', help="URL of forked repair script library map.json https://github.com/{user}/repair-script-library/blob/master/map.json")

with self.argument_context('vm repair reset-nic') as c:
c.argument('subscriptionid', help='Subscription id to default subscription using `az account set -s NAME_OR_ID`.')
Expand All @@ -64,6 +67,9 @@ def load_arguments(self, _):
c.argument('repair_vm_name', help='Name of repair VM.')
c.argument('copy_disk_name', help='Name of OS disk copy.')
c.argument('repair_group_name', help='Name for new or existing resource group that will contain repair VM.')
c.argument('tags', help='Quoted string with space-separated key-value pairs in "key=value" format. Will be appended to the tags required for repair resources.')
c.argument('copy_tags', help='Copy tags from the source VM to the repair VM and its resources. Can be combined with --tags.')
c.argument('size', help='The size of the repair VM to create. If not specified, a size matching the source VM will be used.')

with self.argument_context('vm repair repair-button') as c:
c.argument('button_command', help='Button_command for repair VM.')
Expand All @@ -73,3 +79,7 @@ def load_arguments(self, _):
c.argument('repair_vm_name', help='Name of repair VM.')
c.argument('copy_disk_name', help='Name of OS disk copy.')
c.argument('repair_group_name', help='Name for new or existing resource group that will contain repair VM.')
c.argument('tags', help='Quoted string with space-separated key-value pairs in "key=value" format. Will be appended to the tags required for repair resources.')
c.argument('copy_tags', help='Copy tags from the source VM to the repair VM and its resources. Can be combined with --tags.')
c.argument('size', help='The size of the repair VM to create. If not specified, a size matching the source VM will be used.')
c.argument('yes', help='Deprecated - Creates the repair VM without confirmation. No current behavior change, this parameter will be removed in a future release.')
7 changes: 2 additions & 5 deletions src/vm-repair/azext_vm_repair/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def validate_create(cmd, namespace):
else:
namespace.copy_disk_name = namespace.vm_name + '-DiskCopy-' + timestamp

# Check copy resouce group name
# Check copy resource group name
if namespace.repair_group_name:
if namespace.repair_group_name == namespace.resource_group_name:
raise CLIError('The repair resource group name cannot be the same as the source VM resource group.')
Expand Down Expand Up @@ -91,9 +91,6 @@ def validate_create(cmd, namespace):
_prompt_repair_password(namespace)
# Validate vm password
validate_vm_password(namespace.repair_password, is_linux)
# Prompt input for public ip usage
if (not namespace.associate_public_ip) and (not namespace.yes):
_prompt_public_ip(namespace)


def validate_restore(cmd, namespace):
Expand Down Expand Up @@ -190,7 +187,7 @@ def validate_reset_nic(cmd, namespace):
_call_az_command(set_sub_command)
except AzCommandError as azCommandError:
logger.error(azCommandError)
raise CLIError('Unexpected error occured while setting the subscription..')
raise CLIError('Unexpected error occurred while setting the subscription..')
_validate_and_get_vm(cmd, namespace.resource_group_name, namespace.vm_name)


Expand Down
Loading
Loading