From 8370f460c76ecd5d119b018fc5c8fb5b9f083ed7 Mon Sep 17 00:00:00 2001 From: Bill Wert Date: Thu, 30 Mar 2023 18:21:57 -0700 Subject: [PATCH] Add disable instance discovery to DAC (#34257) --- sdk/identity/azure-identity/CHANGELOG.md | 1 + .../azure/identity/DefaultAzureCredentialBuilder.java | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/sdk/identity/azure-identity/CHANGELOG.md b/sdk/identity/azure-identity/CHANGELOG.md index 56da2da262c1c..aa8f65c3f68ca 100644 --- a/sdk/identity/azure-identity/CHANGELOG.md +++ b/sdk/identity/azure-identity/CHANGELOG.md @@ -8,6 +8,7 @@ ### Bugs Fixed - Fixed detection logic for az/azd. +- Add `disableInstanceDiscovery` to `DefaultAzureCredentialBuilder` ## 1.8.1 (2023-03-06) diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/DefaultAzureCredentialBuilder.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/DefaultAzureCredentialBuilder.java index 616da82717433..efdf4f287c756 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/DefaultAzureCredentialBuilder.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/DefaultAzureCredentialBuilder.java @@ -218,6 +218,17 @@ public DefaultAzureCredentialBuilder additionallyAllowedTenants(List add return this; } + /** + * Disable instance discovery. Instance discovery is acquiring metadata about an authority from https://login.microsoft.com + * to validate that authority. This may need to be disabled in private cloud or ADFS scenarios. + * + * @return An updated instance of this builder with instance discovery disabled. + */ + public DefaultAzureCredentialBuilder disableInstanceDiscovery() { + this.identityClientOptions.disableInstanceDisovery(); + return this; + } + /** * Creates new {@link DefaultAzureCredential} with the configured options set. *