From 287045cdc4e087d4205f22698d6aafbb25c17889 Mon Sep 17 00:00:00 2001 From: Bill Wert Date: Fri, 3 Nov 2023 13:28:07 -0700 Subject: [PATCH] Fix organizations tenant bug in sync client (#37457) --- .../azure/identity/implementation/IdentitySyncClient.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentitySyncClient.java b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentitySyncClient.java index bd09c0270eeec..93928adc969c8 100644 --- a/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentitySyncClient.java +++ b/sdk/identity/azure-identity/src/main/java/com/azure/identity/implementation/IdentitySyncClient.java @@ -361,9 +361,8 @@ public AccessToken authenticateWithAzureCli(TokenRequestContext request) { String tenant = IdentityUtil.resolveTenantId(tenantId, request, options); ValidationUtil.validateTenantIdCharacterRange(tenant, LOGGER); - if (!CoreUtils.isNullOrEmpty(tenant)) { + if (!CoreUtils.isNullOrEmpty(tenant) && !tenant.equals(IdentityUtil.DEFAULT_TENANT)) { azCommand.append(" --tenant ").append(tenant); - } try { @@ -410,7 +409,7 @@ public AccessToken authenticateWithAzureDeveloperCli(TokenRequestContext request String tenant = IdentityUtil.resolveTenantId(tenantId, request, options); ValidationUtil.validateTenantIdCharacterRange(tenant, LOGGER); - if (!CoreUtils.isNullOrEmpty(tenant)) { + if (!CoreUtils.isNullOrEmpty(tenant) && !tenant.equals(IdentityUtil.DEFAULT_TENANT)) { azdCommand.append(" --tenant-id ").append(tenant); }