-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[Compute] az vm/vmss create: Support creating VM/VMSS from community gallery image and add community gallery legal agreement acceptance
#21843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
340bd61
53451c6
263c9cb
6bccd84
a592f65
db4be3e
ddb1665
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1467,6 +1467,9 @@ | |
| - name: Create a VM from shared gallery image (private preview feature, please contact shared image gallery team by email [email protected] to register for preview if you're interested in using this feature). | ||
| text: > | ||
| az vm create -n MyVm -g MyResourceGroup --image /SharedGalleries/{gallery_unique_name}/Images/{image}/Versions/{version} | ||
| - name: Create a VM from community gallery image (private preview feature, please contact community image gallery team by email [email protected] to register for preview if you're interested in using this feature). | ||
| text: > | ||
| az vm create -n MyVm -g MyResourceGroup --image /CommunityGalleries/{gallery_unique_name}/Images/{image}/Versions/{version} | ||
| """ | ||
|
|
||
| helps['vm deallocate'] = """ | ||
|
|
@@ -2841,6 +2844,9 @@ | |
| - name: Create a VMSS from shared gallery image. (private preview feature, please contact shared image gallery team by email [email protected] to register for preview if you're interested in using this feature). | ||
| text: > | ||
| az vmss create -n MyVmss -g MyResourceGroup --image /SharedGalleries/{gallery_unique_name}/Images/{image}/Versions/{version} | ||
| - name: Create a VMSS from community gallery image. (private preview feature, please contact community image gallery team by email [email protected] to register for preview if you're interested in using this feature). | ||
| text: > | ||
| az vmss create -n MyVmss -g MyResourceGroup --image /CommunityGalleries/{gallery_unique_name}/Images/{image}/Versions/{version} | ||
| - name: Create a Windows VMSS with patch mode 'Manual' (Currently patch mode 'AutomaticByPlatform' is not supported during VMSS creation as health extension which is required for 'AutomaticByPlatform' mode cannot be set during VMSS creation). | ||
| text: > | ||
| az vmss create -n MyVmss -g MyResourceGroup --image Win2019Datacenter --enable-agent --enable-auto-update false --patch-mode Manual --orchestration-mode Flexible | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -397,6 +397,34 @@ def parse_shared_gallery_image_id(image_reference): | |||||||||||||||||||||
| return image_info.group(1), image_info.group(2) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def is_community_gallery_image_id(image_reference): | ||||||||||||||||||||||
| if not image_reference: | ||||||||||||||||||||||
| return False | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| community_gallery_id_pattern = re.compile(r'^/CommunityGalleries/[^/]*/Images/[^/]*/Versions/.*$', re.IGNORECASE) | ||||||||||||||||||||||
| if community_gallery_id_pattern.match(image_reference): | ||||||||||||||||||||||
| return True | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| return False | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def parse_community_gallery_image_id(image_reference): | ||||||||||||||||||||||
| from azure.cli.core.azclierror import InvalidArgumentValueError | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if not image_reference: | ||||||||||||||||||||||
| raise InvalidArgumentValueError( | ||||||||||||||||||||||
| 'Please pass in the community gallery image id through the parameter --image') | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| image_info = re.search(r'^/CommunityGalleries/([^/]*)/Images/([^/]*)/Versions/.*$', image_reference, re.IGNORECASE) | ||||||||||||||||||||||
| if not image_info or len(image_info.groups()) < 2: | ||||||||||||||||||||||
|
Comment on lines
+418
to
+419
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not check image version ?
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At present, we need to parse the azure-cli/src/azure-cli/azure/cli/command_modules/vm/_validators.py Lines 565 to 570 in ddb1665
I think we can add version matching when we need to parse the version. What do you think? |
||||||||||||||||||||||
| raise InvalidArgumentValueError( | ||||||||||||||||||||||
| 'The community gallery image id is invalid. The valid format should be ' | ||||||||||||||||||||||
| '"/CommunityGalleries/{gallery_unique_name}/Images/{gallery_image_name}/Versions/{image_version}"') | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Return the gallery unique name and gallery image name parsed from community gallery image id | ||||||||||||||||||||||
| return image_info.group(1), image_info.group(2) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| class ArmTemplateBuilder20190401(ArmTemplateBuilder): | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| def __init__(self): | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.