Exec¶
Use the exec command to run commands on available services (the available services depend on the authorized user's account).
Shorthand
The exec subcommand may be omitted. Service commands can be invoked directly by specifying the service name after idsec. Both forms are equivalent:
| Full form | Shorthand |
|---|---|
idsec exec sia sso short-lived-password |
idsec sia sso short-lived-password |
idsec exec pcloud safes create --safe-name=safe |
idsec pcloud safes create --safe-name=safe |
SIA services¶
The following SIA commands are supported:
idsec sia: Root command for the SIA service (aliases: dpa)sso- SSO end-user operationsk8s- Kubernetes servicedb- DB serviceworkspaces- Workspaces servicetarget-sets- Target sets operationsdb- Database operationssecrets- Secrets servicevm- VM operationsdb- Database operationsaccess- Access servicessh-ca- SSH CA key serviceshortened-connection-string- Shortened connection string servicesettings- Settings servicecertificates- Certificates service
idsec cmgr: Root command for the CMGR service (aliases: connectormanager,cm)idsec pcloud: Root command for PCloud service (aliases: privilegecloud,pc)accounts- Accounts managementsafes- Safes managementplatforms- Platforms managementapplications- Applications management
idsec identity: Root command for the Identity service (aliases: idaptive,id)directories- Directories managementusers- Users managementroles- Roles managementauth-profiles- Auth profiles managementpolicies- Policies management
idsec sechub: Root command for the Secrets Hub Service (aliases: secretshub,sh)configuration- Configuration managementservice-info- Service Info managementsecrets- Secrets managementscans- Scans managementsecret-stores- Secret Stores managementsync-policies- Sync Policies management
idsec sm: Root command for the SM service (aliases: sessionmonitoring)idsec policy: Root command for the Policy service (aliases: accesspolicies, acp)cloud-access- Cloud Console managementdb- SIA DB managementvm- SIA VM management
All commands have their own subcommands and respective arguments and aliases.
Running¶
idsec exec
Paging long list output¶
Use --page-size when a command returns a long list and you want to browse the result in the terminal.
idsec policy cloud-access list-policies --profile-name myprofile --page-size 10
When --page-size is set and the command is running in an interactive terminal, the CLI prints exactly that number of items and waits for a keypress:
- Press
spaceorEnterto show the next page. - Press
q,Esc,Ctrl+C, orCtrl+Dto stop paging.
The pager controls only page boundaries and continue/quit behavior. Item rendering stays with command output formatting (currently pretty JSON for these list results). Between pages, output is appended so you can scroll up to previous pages.
Paging is client-side only. The CLI still receives the SDK result and only controls interactive paging flow. When output is piped or redirected, the interactive pager is disabled and the CLI writes a JSON array so commands remain scriptable:
idsec policy cloud-access list-policies --profile-name myprofile --page-size 10 | jq '.'
Search is not built into the interactive pager. For searching or filtering, pipe the command output to tools such as less, grep, or jq:
idsec policy cloud-access list-policies --profile-name myprofile | less
Filtering output with --query¶
Use --query to apply a jq expression to the JSON output of any exec command, without requiring jq to be installed — the query runs in-process using gojq.
# Print just the safe name from a get-safe result
idsec exec pcloud safes get --safe-id MySafe --query '.safeName'
# Extract the name of every pool whose type is ACCESS
idsec exec cmgr pools list --query '.[] | select(.type == "ACCESS") | .name'
# List pool IDs as a compact array
idsec exec cmgr pools list --query '[.[].pool_id]'
--query takes precedence over --format and service-defined formatters: the full JSON output is always passed to the expression, regardless of how the service would otherwise render it.
Multiple output values (e.g. from .[]) are each printed as a separate JSON value on its own line. Errors in the query expression (syntax, type mismatches) are returned as command errors with a non-zero exit code.
When a command produces no result value (for example an action that returns nothing), the query runs against JSON null — matching jq's empty-input model — instead of printing a status sentence. This keeps captures such as ID=$(idsec ... --query '.pool_id // ""') clean and empty rather than picking up a human-readable message.
Binding shell values (--arg / --argjson)¶
Never interpolate a shell value into the query string — a name like x") | .credentials, (" would rewrite the expression (jq-program injection). Instead bind it to a jq variable and reference it as $name:
# Safe: the name is data, not program
idsec exec cmgr pools list --query '.[] | select(.name == $n) | .pool_id' --arg n="$POOL_NAME"
# --argjson binds a JSON value (number, bool, object, array)
idsec exec cmgr pools list --query '.[] | select(.size > $min)' --argjson min=10
Both flags are repeatable and take a single name=value token (the value is split on the first =). The variable name must be a valid identifier. These work the same on login, status, profiles list, and configure, and on the standalone query command.
Raw string output (--raw)¶
By default a string result is printed quoted, so the output stays valid JSON and can be piped onward. Add the common --raw flag to print a top-level string result unquoted, like jq -r — useful when capturing a single scalar into a shell variable (--raw also disables colored output, which keeps the captured value clean):
# Quoted (default): "pool-123"
idsec exec cmgr pools get-by-name --name mypool --query '.pool_id'
# Raw: pool-123
POOL_ID=$(idsec exec cmgr pools get-by-name --name mypool --raw --query '.pool_id')
--raw only affects top-level string results; objects, arrays, numbers, and booleans are always rendered as JSON.
Dry run¶
Use --dry-run to preview what a command would do without authenticating or executing it. Instead of running the action, the CLI prints a JSON plan describing the operation, the profile it would use, the resolved arguments (the flags you provided plus any applied defaults), and which of those arguments are secrets.
--dry-run is a purely local preview: it does not load a profile, contact any service, or require you to be logged in, and it never performs the action. Under --dry-run, normally required flags are not enforced, so you can preview a plan without re-specifying every required argument.
--dry-run reads --request-file too: the request file's values are merged into resolved_args (an explicit flag wins over a request-file value), and any secrets it carries are masked and listed in secret_fields. Because the request file is the recommended channel for secrets, the plan reflects them accurately rather than reporting secret_fields: [].
idsec sia access install-connector --dry-run \
--profile-name prod \
--target-machine db-01 \
--connector-pool-id pool-123 \
--password s3cr3t
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
The plan fields are:
operation- the dotted service path and action that would run, e.g.sia.access.install_connector.profile- the effective profile name that would be used (resolved from--profile-name, not loaded).resolved_args- the effective arguments keyed by flag name. Includes flags you provided and any schema defaults that would be applied; arguments you did not set and that have no default are omitted.secret_fields- theresolved_argskeys whose values are secrets.
Secret arguments (passwords, private keys, access keys, tokens, etc.) are always masked as *** in resolved_args and listed under secret_fields, so the plan is safe to share or log. Secrets are identified by the service model definitions, so masking stays correct as new commands are added.
Querying the plan¶
--query applies to the plan as well, so an expression can be rehearsed against a plan before the command is run for real, and a single plan field can be pulled out for a script or an assertion:
# Which pool would this actually target?
idsec sia access install-connector --dry-run --connector-pool-id pool-123 \
--target-machine db-01 --raw --query '.resolved_args["connector-pool-id"]'
# Fail a pre-flight check if the plan carries any secret
idsec sia access install-connector --dry-run --target-machine db-01 \
--query '.secret_fields | length == 0'
Usage¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |