Skip to content

Commit fcf340c

Browse files
authored
Add logging for user-assigned managed identity (#44305)
Fixes #43741
1 parent 67b04a7 commit fcf340c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sdk/identity/azure-identity/src/main/java/com/azure/identity/ManagedIdentityCredential.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ public Mono<AccessToken> getToken(TokenRequestContext request) {
199199
+ " https://aka.ms/azsdk/java/identity/managedidentitycredential/troubleshoot")));
200200
}
201201

202+
// Not having a managedIdentityId at this point means it is a system-assigned managed identity.
202203
if (!CoreUtils.isNullOrEmpty(managedIdentityId)) {
203204
ManagedIdentitySourceType managedIdentitySourceType = ManagedIdentityApplication.getManagedIdentitySource();
204205
if (ManagedIdentitySourceType.CLOUD_SHELL.equals(managedIdentitySourceType)
@@ -211,6 +212,8 @@ public Mono<AccessToken> getToken(TokenRequestContext request) {
211212
? "DefaultAzureCredentialBuilder."
212213
: "ManagedIdentityCredentialBuilder."))));
213214
}
215+
216+
LOGGER.info("User-assigned Managed Identity ID: " + getClientId());
214217
}
215218

216219
return managedIdentityServiceCredential.authenticate(request)

0 commit comments

Comments
 (0)