vagrant-azure
vagrant-azure copied to clipboard
Azure::Action::ConnectAzure is not using azure.endpoint, if configured
trafficstars
When explicitly setting the endpoint url in Vagrantfile
Vagrant.configure('2') do |config|
config.vm.box = 'azure'
config.vm.provider :azure do |azure, override|
azure.endpoint = 'https://management.microsoftazure.de'
...
end
end
the configured value is not propagated to the clients (ComputeManagementClient, ResourceManagementClient, ...), because it is not set in the ConnectAzure class:
action/connect_azure.rb
module Azure
module Action
class ConnectAzure
...
def call (env)
...
env[:azure_arm_service] = VagrantPlugins::Azure::Services::AzureResourceManager.new(provider, config.subscription_id)
...
The endpoint needs to be provided as third parameter to the initializer of AzureResourceManager:
env[:azure_arm_service] = VagrantPlugins::Azure::Services::AzureResourceManager.new(provider, config.subscription_id, config.endpoint)
, otherwise the base_url will always be nil and
@base_url = base_url || 'https://management.azure.com'
will set the fallback url and not the configured endpoint url.
Current impact is, that you cannot use the azure provider for AzureGermanCloud or AzureChinaCloud because the fallback url is used and not the configured endpoint url.