Skip to content

Commit

Permalink
Don't pass organizations to CLIs (#35764)
Browse files Browse the repository at this point in the history
For some flows `organizations` is an invalid tenant ID when acquiring a token, and passing it will result in a break.
  • Loading branch information
billwert committed Jul 6, 2023
1 parent a09c380 commit 2e5aba7
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ public Mono<AccessToken> authenticateWithAzureCli(TokenRequestContext request) {

try {
String tenant = IdentityUtil.resolveTenantId(tenantId, request, options);
if (!CoreUtils.isNullOrEmpty(tenant)) {
// The default is not correct for many cases, such as when the logged in entity is a service principal.
if (!CoreUtils.isNullOrEmpty(tenant) && !tenant.equals(IdentityUtil.DEFAULT_TENANT)) {
azCommand.append(" --tenant ").append(tenant);
}
} catch (ClientAuthenticationException e) {
Expand Down Expand Up @@ -362,7 +363,7 @@ public Mono<AccessToken> authenticateWithAzureDeveloperCli(TokenRequestContext r

try {
String tenant = IdentityUtil.resolveTenantId(tenantId, request, options);
if (!CoreUtils.isNullOrEmpty(tenant)) {
if (!CoreUtils.isNullOrEmpty(tenant) && !tenant.equals(IdentityUtil.DEFAULT_TENANT)) {
azdCommand.append(" --tenant-id ").append(tenant);
}
} catch (ClientAuthenticationException e) {
Expand Down

0 comments on commit 2e5aba7

Please sign in to comment.