@@ -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'
@@ -237,7 +238,9 @@ export const smusLoginCommand = Commands.declare('aws.smus.login', () => async (
237238 if ( ! domainUrl ) {
238239 // User cancelled
239240 logger . debug ( 'User cancelled domain URL input' )
240- return
241+ throw new ToolkitError ( 'User cancelled domain URL input' , {
242+ cancelled : true ,
243+ } )
241244 }
242245
243246 // Show a simple status bar message instead of progress dialog
@@ -256,7 +259,7 @@ export const smusLoginCommand = Commands.declare('aws.smus.login', () => async (
256259 } )
257260 }
258261
259- // Extract domain ID and region for logging
262+ // Extract domain account ID, domain ID, and region for logging
260263 const domainId = connection . domainId
261264 const region = connection . ssoRegion
262265
@@ -265,6 +268,18 @@ export const smusLoginCommand = Commands.declare('aws.smus.login', () => async (
265268 smusDomainId : domainId ,
266269 awsRegion : region ,
267270 } )
271+ try {
272+ const derCredProvider = await authProvider . getDerCredentialsProvider ( )
273+ const stsClient = new DefaultStsClient ( region , await derCredProvider . getCredentials ( ) )
274+ const callerIdentity = await stsClient . getCallerIdentity ( )
275+ span . record ( {
276+ smusDomainAccountId : callerIdentity . Account ,
277+ } )
278+ } catch ( err ) {
279+ logger . error (
280+ `Failed to resolve AWS account ID via STS Client for domain ${ domainId } in region ${ region } : ${ err } `
281+ )
282+ }
268283
269284 // Show success message
270285 void vscode . window . showInformationMessage (
@@ -334,6 +349,18 @@ export const smusSignOutCommand = Commands.declare('aws.smus.signOut', () => asy
334349 smusDomainId : domainId ,
335350 awsRegion : region ,
336351 } )
352+ try {
353+ const derCredProvider = await authProvider . getDerCredentialsProvider ( )
354+ const stsClient = new DefaultStsClient ( region ! , await derCredProvider . getCredentials ( ) )
355+ const callerIdentity = await stsClient . getCallerIdentity ( )
356+ span . record ( {
357+ smusDomainAccountId : callerIdentity . Account ,
358+ } )
359+ } catch ( err ) {
360+ logger . error (
361+ `Failed to resolve AWS account ID via STS Client for domain ${ domainId } in region ${ region } : ${ err } `
362+ )
363+ }
337364
338365 // Delete the connection (this will also invalidate tokens and clear cache)
339366 if ( activeConnection ) {
0 commit comments