Skip to content

Commit

Permalink
Add EnvVar AZURE_AUTHORITY_HOST (#9392)
Browse files Browse the repository at this point in the history
  • Loading branch information
Luyunmt authored Apr 2, 2020
1 parent a1bef67 commit 6edef4f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ public class Configuration implements Cloneable {
* Name of the Azure cloud to connect to.
*/
public static final String PROPERTY_AZURE_CLOUD = "AZURE_CLOUD";


/**
* The Azure Active Directory endpoint to connect to.
*/
public static final String PROPERTY_AZURE_AUTHORITY_HOST = "AZURE_AUTHORITY_HOST";

/**
* Disables telemetry collection.
*/
Expand Down Expand Up @@ -124,6 +129,7 @@ public class Configuration implements Cloneable {
PROPERTY_AZURE_TENANT_ID,
PROPERTY_AZURE_RESOURCE_GROUP,
PROPERTY_AZURE_CLOUD,
PROPERTY_AZURE_AUTHORITY_HOST,
PROPERTY_AZURE_TELEMETRY_DISABLED,
PROPERTY_AZURE_LOG_LEVEL,
PROPERTY_AZURE_TRACING_DISABLED,
Expand Down
2 changes: 1 addition & 1 deletion sdk/identity/azure-identity/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.3.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
<version>1.4.0-beta.1</version> <!-- {x-version-update;unreleased_com.azure:azure-core;dependency} -->
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.azure.core.http.HttpClient;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.ProxyOptions;
import com.azure.core.util.Configuration;
import com.azure.identity.KnownAuthorityHosts;

import java.time.Duration;
Expand Down Expand Up @@ -33,7 +34,8 @@ public final class IdentityClientOptions {
* Creates an instance of IdentityClientOptions with default settings.
*/
public IdentityClientOptions() {
authorityHost = KnownAuthorityHosts.AZURE_CLOUD;
Configuration configuration = Configuration.getGlobalConfiguration();
authorityHost = configuration.get(Configuration.PROPERTY_AZURE_AUTHORITY_HOST, KnownAuthorityHosts.AZURE_CLOUD);
maxRetry = MAX_RETRY_DEFAULT_LIMIT;
retryTimeout = i -> Duration.ofSeconds((long) Math.pow(2, i.getSeconds() - 1));
}
Expand Down

0 comments on commit 6edef4f

Please sign in to comment.