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 getreturns inassigneeId,reporterIdandcomments[].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.jsmyself.getCurrentUser(/rest/api/3/myselfon Cloud,/rest/api/2/myselfon Server / Data Center). - Azure Boards:
connectionDataof the organization (azure-devops-node-apiWebApi.connect), fieldauthenticatedUser. - ServiceNow: the
sys_userrecord ofSERVICENOW_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