ansible-collections / azure

Development area for Azure Collections
https://galaxy.ansible.com/azure/azcollection
GNU General Public License v3.0
247 stars 330 forks source link

Support Community Gallery image ID in azure_rm_virtualmachine and azure_rm_virtualmachinescaleset #1757

Open arvindshmicrosoft opened 1 week ago

arvindshmicrosoft commented 1 week ago
SUMMARY

Currently neither azure_rm_virtualmachine nor azure_rm_virtualmachinescaleset support specifying the community gallery image ID in the image.id parameter. For example, if we attempt to create a Fedora 40 image using the Community gallery image ID /CommunityGalleries/Fedora-5e266ba4-2250-406d-adad-5d73860d958f/Images/Fedora-Cloud-40-x64/Versions/latest, these Ansible modules error out:

Error creating or updating virtual machine myVM - (LinkedInvalidPropertyId) Property id '/CommunityGalleries/fedora-5e266ba4-2250-406d-adad-5d73860d958f/Images/Fedora-Cloud-40-x64/Versions/latest' at path 'properties.storageProfile.imageReference.id' is invalid.
Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.\nCode: LinkedInvalidPropertyId\nMessage: Property id '/CommunityGalleries/fedora-5e266ba4-2250-406d-adad-5d73860d958f/Images/Fedora-Cloud-40-x64/Versions/latest' at path 'properties.storageProfile.imageReference.id' is invalid.
Expect fully qualified resource Id that start with '/subscriptions/{subscriptionId}' or '/providers/{resourceProviderNamespace}/'.
ISSUE TYPE
COMPONENT NAME

azure_rm_virtualmachine and azure_rm_virtualmachinescaleset

ADDITIONAL INFORMATION

Fedora images are conveniently available for Azure by using the Community Image Gallery. In Python SDK, there is already support in the ImageReference for community_gallery_image_id. If Ansible provides a hook into using these Community gallery images, it would greatly simplify the provisioning and usage of Fedora and other images hosted in the Community Image Gallery.

Fred-sun commented 1 week ago

Added in #1759