Skip to content
This repository has been archived by the owner on Jan 30, 2021. It is now read-only.

Support for Azure Environments like AzureGermanCloud, AzureChinaCloud, ... ? #209

Open
rmontag opened this issue Dec 8, 2017 · 0 comments

Comments

@rmontag
Copy link

rmontag commented Dec 8, 2017

Hi,

I'm trying to get the azure provider running with AzureGermanCloud and have encountered some problems. The first one is that I cannot configure the provider to use endpoint URLs for AzureGermanCloud; the provider is always using the AzureCloud URLs.

I have checked the module MsRestAzure from ms_rest_azure-0.7.0 and the module supports different Azure environments (e.g. AzureGermanCloud).

 module MsRestAzure
  class ActiveDirectoryServiceSettings  
  def self.get_azure_settings
      get_settings(MsRestAzure::AzureEnvironments::AzureCloud)
  end
  
  def self.get_azure_german_settings
      get_settings(MsRestAzure::AzureEnvironments::AzureGermanCloud)
  end

The class MsRestAzure::ApplicationTokenProvider also supports setting the Environment:

def initialize(tenant_id, client_id, client_secret, settings = ActiveDirectoryServiceSettings.get_azure_settings)

So in case the initializer is calling without explicitly setting the "settings" parameter, is uses the AzureCloud environment. Now checking the usage in the azure provider modules, I find no method to configure the settings to use:

  1. vagrant-azure/action/connect_azure.rb
def call (env)
            provider = MsRestAzure::ApplicationTokenProvider.new(config.tenant_id, config.client_id, config.client_secret)
      end
  1. vagrant-azure/services/azure_resource_manager.rb
def initialize(token_provider, subscription_id, base_url = nil)
                                MsRestAzure::ApplicationTokenProvider.new(
                                    ENV[TENANT_ID_NAME],
                                    ENV[CLIENT_ID_NAME],
                                    ENV[CLIENT_SECRET_NAME])
          @credential = MsRest::TokenCredentials.new(token_provider)
          @base_url = base_url
          @subscription_id = subscription_id
        end

Both does not set the settings parameter, thus using the default AzureCloud.

As I understand, I am currently not able to use the azure provider for other Azure environments like AzureGermanCloud, AzureChinaCloud - as method aquire_token will use the wrong URL?

Also setting the azure provider parameter endpoint explicitly to the e.g. german endpoint does not seem to affect the token retrieval too.

Vagrant.configure('2') do |config|
  config.vm.box = 'azure'
  config.vm.provider :azure do |azure, override|
    azure.endpoint = 'https://management.microsoftazure.de'
...
  end
end

(not working)

Thanks in advance,
Rainer

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant