Skip to content

[Compute] az vm update / az sig image-version update: Support update vm/image-version even it uses a cross tenant image#15575

Merged
arrownj merged 2 commits intoAzure:devfrom
arrownj:vm_image_version_update
Oct 21, 2020
Merged

[Compute] az vm update / az sig image-version update: Support update vm/image-version even it uses a cross tenant image#15575
arrownj merged 2 commits intoAzure:devfrom
arrownj:vm_image_version_update

Conversation

@arrownj
Copy link
Contributor

@arrownj arrownj commented Oct 19, 2020

Description
This PR is to fix #15536

Previously, the user can't update a vm/image-version if the vm/image-version uses a cross tenant image which he/she has no permission to access.

The root cause is that CLI use the create_or_update API to in update command to support generic update. The service will check all the properties in the request body even the property value is not changed.

To fix this, we need to set the storage_profile.image_reference / storage_profile.source to None in the request body if the user is not updating the image property itself.

There is a similar PR #14992 which created by @qwordy .

Testing Guide
Prepare a image, assume its id is <IMGAGE_ID>, and in <subscription_1>

update vm
az account set -s <subscription_2>
az vm create -g <rg> -n <vm_name> --image <IMAGE_ID>

login with another user account who doesn't as <subscription_1> permission.

az vm update -g <rg> -n <vm_name> hardwareProfile.vmSize=Standard_B2

History Notes

[Component Name 1] BREAKING CHANGE: az command a: Make some customer-facing breaking change.
[Component Name 2] az command b: Add some customer-facing feature.


This checklist is used to make sure that common guidelines for a pull request are followed.

…vm/image-version even it use a cross tenant image
@arrownj arrownj requested a review from qwordy as a code owner October 19, 2020 10:48
@arrownj arrownj self-assigned this Oct 19, 2020
@yonzhan
Copy link
Collaborator

yonzhan commented Oct 19, 2020

Compute

else get_vm(cmd, resource_group_name, vm_name)


def get_vm_for_generic_update(cmd, resource_group_name, vm_name):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you can add some comments like PR description here.

@qwordy
Copy link
Member

qwordy commented Oct 20, 2020

line too long error

@arrownj arrownj merged commit e4a2e19 into Azure:dev Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't update vm or image-version if reference to a cross tenant image

3 participants