Skip to content

Feature Request: Support Custom Clouds #2555

@bblommers

Description

@bblommers

We have a custom cloud registered like so:

az cloud register --name OurCloud ..

We'd like to use it in conjunction with the azure-webapp-maven-plugin, configured like so:

<plugin>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-webapp-maven-plugin</artifactId>
    <version>2.14.1</version>
    <configuration>
        <auth>
	        <type>azure_cli</type>
        </auth>
        ...                             

But this throws an IllegalArgumentException when calling mvn azure-webapp:deploy:

...
Caused by: java.lang.IllegalArgumentException: Unknown azure environment.
    at com.microsoft.azure.toolkit.lib.auth.AzureEnvironmentUtils.getCloudName (AzureEnvironmentUtils.java:44)
    at com.microsoft.azure.toolkit.lib.auth.cli.AzureCliAccount.setupAfterLogin (AzureCliAccount.java:74)
    at com.microsoft.azure.toolkit.lib.auth.Account.login (Account.java:99)
    at com.microsoft.azure.toolkit.lib.auth.AzureAccount.login (AzureAccount.java:127)
...

The AzureEnvironmentUtils only supports the default clouds: Azure, China, Germany, USGov:

static {
// the first alias is the cloud name in azure cli
// the second alias is the display name, all other aliases are only used in our toolkit
putAliasMap(AzureEnvironment.AZURE, "AzureCloud", "azure", "azure_cloud", "GLOBAL");
putAliasMap(AzureEnvironment.AZURE_CHINA, "AzureChinaCloud", "azure_china", "AzureChina", "azure_china_cloud", "CHINA");
// the TYPO:azure_german comes from azure cli: https://docs.microsoft.com/en-us/azure/germany/germany-get-started-connect-with-cli
putAliasMap(AzureEnvironment.AZURE_GERMANY, "AzureGermanCloud", "azure_germany", "azure_german",
"azure_germany_cloud", "azure_german_cloud", "AzureGerman", "AzureGermany", "GERMAN");
putAliasMap(AzureEnvironment.AZURE_US_GOVERNMENT, "AzureUSGovernment", "azure_us_government", "US_GOVERNMENT");
}

Considering that we're logging in using the az CLI, I don't see why the exact cloud name matters - az has already validated that this cloud exists/is valid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions