I’m trying to figure out how to deploy an Azure VM from a marketplace image. Having looked at the source code for the provider, I don’t believe there is a way to do this, as it appears to be hardcoded to accept only managed images or unmanaged VHDs.
if source.ems_ref.starts_with?('/subscriptions')
os = source.operating_system.product_name
target_uri, source_uri = nil
else
target_uri, source_uri, os = gather_storage_account_properties
end
...
...
if target_uri
cloud_options[:properties][:storageProfile][:osDisk][:name] = dest_name + SecureRandom.uuid + '.vhd'
cloud_options[:properties][:storageProfile][:osDisk][:image] = {:uri => source_uri}
cloud_options[:properties][:storageProfile][:osDisk][:vhd] = {:uri => target_uri}
else
# Default to a storage account type of "Standard_LRS" for managed images for now.
cloud_options[:properties][:storageProfile][:osDisk][:managedDisk] = {:storageAccountType => 'Standard_LRS'}
cloud_options[:properties][:storageProfile][:imageReference] = {:id => source.ems_ref}
end
from cloning.rb
My question is whether there is a way to override this behavior from the provisioning state machine method, so that I may avoid making changes to the provider’s source code. If not, I suppose I could get around this by using Ansible, but I would rather not introduce and support that if it’s not absolutely necessary.