Skip to content

Commit a38b8d1

Browse files
authored
Continue with warning when getting subscriptions & AADSTS50057 occurs on one tenant (#4991)
Reported and seen in JetBrains#438
1 parent 1c042ec commit a38b8d1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Utils/azuretools-core/src/com/microsoft/azuretools/sdkmanage/AzureManagerBase.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,11 @@ public List<Pair<Subscription, Tenant>> getSubscriptionsWithTenant() {
128128
} catch (final Exception e) {
129129
// just skip for cases user failing to get subscriptions of tenants he/she has no permission to get access token.
130130
// "AADSTS50076" is the code of a weired error related to multi-tenant configuration.
131-
final Predicate<Throwable> tenantError = (c) -> c instanceof AuthException && ((AuthException) c).getErrorMessage().contains("AADSTS50076");
131+
// "AADSTS50057" is the code of an error related to having a disabled account in the tenant.
132+
final Predicate<Throwable> tenantError = (c) -> c instanceof AuthException &&
133+
(((AuthException) c).getErrorMessage().contains("AADSTS50076") ||
134+
((AuthException) c).getErrorMessage().contains("AADSTS50057"));
135+
132136
if (e instanceof AzureRuntimeException && ((AzureRuntimeException) e).getCode() == ErrorEnum.FAILED_TO_GET_ACCESS_TOKEN.getErrorCode() ||
133137
Throwables.getCausalChain(e).stream().anyMatch(tenantError)) {
134138
// TODO: @wangmi better to notify user

0 commit comments

Comments
 (0)