@@ -8,6 +8,7 @@ import { TreeNode } from '../../../shared/treeview/resourceTreeDataProvider'
88import { getIcon } from '../../../shared/icons'
99import { getLogger } from '../../../shared/logger/logger'
1010import { DataZoneClient , DataZoneProject } from '../../shared/client/datazoneClient'
11+ import { DefaultStsClient } from '../../../shared/clients/stsClient'
1112import { Commands } from '../../../shared/vscode/commands2'
1213import { telemetry } from '../../../shared/telemetry/telemetry'
1314import { createQuickPick } from '../../../shared/ui/pickerPrompter'
@@ -256,7 +257,7 @@ export const smusLoginCommand = Commands.declare('aws.smus.login', () => async (
256257 } )
257258 }
258259
259- // Extract domain ID and region for logging
260+ // Extract domain account ID, domain ID, and region for logging
260261 const domainId = connection . domainId
261262 const region = connection . ssoRegion
262263
@@ -265,6 +266,18 @@ export const smusLoginCommand = Commands.declare('aws.smus.login', () => async (
265266 smusDomainId : domainId ,
266267 awsRegion : region ,
267268 } )
269+ try {
270+ const derCredProvider = await authProvider . getDerCredentialsProvider ( )
271+ const stsClient = new DefaultStsClient ( region , await derCredProvider . getCredentials ( ) )
272+ const callerIdentity = await stsClient . getCallerIdentity ( )
273+ span . record ( {
274+ smusDomainAccountId : callerIdentity . Account ,
275+ } )
276+ } catch ( err ) {
277+ logger . error (
278+ `Failed to resolve AWS account ID via STS Client for domain ${ domainId } in region ${ region } : ${ err } `
279+ )
280+ }
268281
269282 // Show success message
270283 void vscode . window . showInformationMessage (
@@ -334,6 +347,18 @@ export const smusSignOutCommand = Commands.declare('aws.smus.signOut', () => asy
334347 smusDomainId : domainId ,
335348 awsRegion : region ,
336349 } )
350+ try {
351+ const derCredProvider = await authProvider . getDerCredentialsProvider ( )
352+ const stsClient = new DefaultStsClient ( region ! , await derCredProvider . getCredentials ( ) )
353+ const callerIdentity = await stsClient . getCallerIdentity ( )
354+ span . record ( {
355+ smusDomainAccountId : callerIdentity . Account ,
356+ } )
357+ } catch ( err ) {
358+ logger . error (
359+ `Failed to resolve AWS account ID via STS Client for domain ${ domainId } in region ${ region } : ${ err } `
360+ )
361+ }
337362
338363 // Delete the connection (this will also invalidate tokens and clear cache)
339364 if ( activeConnection ) {
0 commit comments