Deploying Azure Marketplace Images

fine
providers

#1

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.


#2

This isn’t supported yet, but it’s certainly possible using the azure-armrest gem, which is what we do under the hood. However, I don’t know right off if adding support for this requires any UI modifications.

Please submit an RFE for this.


#3

I looked at the code for the AWS provider, which does support the AWS equivalent (called ‘public’ images in that provider). They add a setting for pulling those in config/settings.yml, and act on that in refresh_parser. They also add a filter in the same location so one can avoid pulling thousands of images. I think it shouldn’t be too difficult to create something similar in the Azure provider.