Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spring cloud env configuration #21613

Closed

Conversation

yiliuTo
Copy link
Member

@yiliuTo yiliuTo commented May 17, 2021

This pr is to fix the bug in #21336 that spring cloud libraries cannot support all azure clouds. The solution is to provide another property "spring.cloud.azure.cloud-name" to allow users to specify the cloud name, and deprecate the old one "spring.cloud.azure.environment".

@ghost ghost added the azure-spring All azure-spring related issues label May 17, 2021
@yiliuTo yiliuTo marked this pull request as draft May 17, 2021 13:43
@yiliuTo yiliuTo self-assigned this May 18, 2021
@yiliuTo yiliuTo added this to the [2021] June milestone May 18, 2021
@yiliuTo yiliuTo added the Client This issue points to a problem in the data-plane of the library. label May 18, 2021
@yiliuTo yiliuTo force-pushed the fix-spring-cloud-env-configuration branch from a220fb5 to 71f4a9c Compare May 18, 2021 07:19
@yiliuTo yiliuTo marked this pull request as ready for review May 18, 2021 08:11
@yiliuTo
Copy link
Member Author

yiliuTo commented May 18, 2021

/azp run java - spring - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@stliu
Copy link
Member

stliu commented May 18, 2021

/**
* Enum to define the authority host uri for all Azure Cloud environments: Azure, Azure China...
*/
public enum AzureCloud {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me this should be part of azure-core instead of be part of our spring module, since all azure sdk requires this kind of configuration.

would you confirm?

@@ -39,9 +39,12 @@ private TokenCredential populateTokenCredential(String prefix, boolean createDef
String tenantId = getPropertyValue(prefix, "tenant-id");
String clientId = getPropertyValue(prefix, "client-id");
String clientSecret = getPropertyValue(prefix, "client-secret");
AzureCloud azureCloud = getPropertyValue(AzureCloud.class, prefix, "cloud-name", AzureCloud.Azure);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really not a big fan of using this cloud-name as property name, wired and not clear

}

private static AzureEnvironment toAzureEnvironment(AzureCloud azureCloud) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not we just use the AzureEnvironment from sdk?

/**
* Enum to define the authority host uri for all Azure Cloud environments: Azure, Azure China...
*/
public enum AzureCloud {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This configuration is available here in azure-identity SDK,

Since spring identity SDK takes a compile dependency on azure-identity.
It can use the AzureAuthorityHosts class from it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, we will refactor our implemention here then

@yiliuTo yiliuTo modified the milestones: [2021] June, [2021] July Jun 2, 2021
@@ -30,7 +30,7 @@

private String resourceGroup;

private AzureEnvironments environment = AzureEnvironments.Azure;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're not deprecating this property as change log stated but removing it

@yiliuTo
Copy link
Member Author

yiliuTo commented Jul 7, 2021

Close this PR for #22396 refactors it.

@yiliuTo yiliuTo closed this Jul 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
azure-spring All azure-spring related issues Client This issue points to a problem in the data-plane of the library.
Projects
None yet
3 participants