Skip to content

hardis🎫whoami

Description

Command Behavior

Shows the account the configured credentials authenticate as on the ticketing system, so that a script can check its setup before a run.

  • Returns the account id, the display name and the e-mail address (null when the system hides it).
  • The id is the one ticket get returns in assigneeId, reporterId and comments[].authorId: comparing them tells which comments the authenticated account wrote.
  • Without --provider, the only configured ticketing system is used.

Supported ticketing systems

Provider Supported Id returned
JIRA Cloud Yes accountId
JIRA Server / Data Center Yes user name
Azure Boards Yes identity id (GUID)
ServiceNow Yes user name (sys_created_by of journal entries)
Aha! Yes user id

Errors

TicketProviderNotConfigured (no usable credential, or the credential is refused), TicketProviderNotSupported, TicketRateLimited.

Technical explanations
  • JIRA: jira.js myself.getCurrentUser (/rest/api/3/myself on Cloud, /rest/api/2/myself on Server / Data Center).
  • Azure Boards: connectionData of the organization (azure-devops-node-api WebApi.connect), field authenticatedUser.
  • ServiceNow: the sys_user record of SERVICENOW_USERNAME. The id is the user name, the value ServiceNow writes as the author of every journal entry.
  • Aha!: /api/v1/me.
  • A read answered 5xx is retried once.

Agent Mode

The command never prompts:

sf hardis ticket whoami --provider azure --agent --json

Parameters

Name Type Description Default Required Options
agent boolean Run in non-interactive mode for agents and automation
debug
-d
boolean Activate debug mode (more logs)
flags-dir option Import flag values from a directory.
json boolean Format output as json.
provider
-p
option Ticketing system to query. Defaults to the only one configured jira
azure
servicenow
aha
skipauth boolean Skip authentication check when a default username is required
websocket option Websocket host:port for VsCode SFDX Hardis UI integration

Examples

$ sf hardis:ticket:whoami
$ sf hardis:ticket:whoami --provider jira --agent --json
$ sf hardis:ticket:whoami --provider azure --agent --json
$ sf hardis:ticket:whoami --provider servicenow --agent --json
$ sf hardis:ticket:whoami --provider aha --agent --json

Comments