Skip to content

CLI

awctl is the command-line client for the Admin API. It manages the same objects the admin console and the Terraform provider manage, inside a tenant, and its command tree mirrors the provider’s resource table, so a resource you know in one is spelled the same way in the other.

Commands follow one shape:

awctl SERVICE RESOURCES VERB [NAME] [FLAGS]

SERVICE is identity, access, guard, or audit, RESOURCES is a plural such as realms or clients, and VERB is one of create, list, describe, update, edit, or delete. NAME is a short AWID such as r-01 or a full resource name such as tenants/t-01/realms/r-01; both work.

Binaries are published to the awctl package registry on git.authwise.com for darwin and linux on amd64 and arm64, and for windows on amd64. The project is public, so downloads need no credential. To install a release:

Terminal window
VERSION=AWCTL_VERSION
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/')
BASE="https://git.authwise.com/api/v4/projects/6/packages/generic/awctl/${VERSION}"
curl -fsSL -o awctl "${BASE}/awctl_${VERSION}_${OS}_${ARCH}"
curl -fsSL -o SHA256SUMS "${BASE}/awctl_${VERSION}_SHA256SUMS"
grep "awctl_${VERSION}_${OS}_${ARCH}" SHA256SUMS | sed "s|awctl_${VERSION}_${OS}_${ARCH}|awctl|" | shasum -a 256 -c -
chmod +x awctl && sudo mv awctl /usr/local/bin/awctl
awctl version

AWCTL_VERSION is a release version such as 0.5.0; the project’s package registry lists them. Releases are plain X.Y.Z versions; a version with a commit suffix is a development build.

A profile tells awctl where an install is and which issuer you sign in at. To connect to an install, create a profile and sign in:

Terminal window
awctl config profiles create PROFILE \
--endpoint API_HOST:443 \
--auth-issuer https://ADMIN_HOST
awctl auth login
  • PROFILE is a name you choose for the install, such as prod.
  • API_HOST is the Admin API host. awctl reaches it over gRPC with TLS.
  • ADMIN_HOST is the install’s admin issuer host.

The values depend on where Authwise runs:

InstallAPI_HOSTADMIN_HOSTToken URLAudience
The Authwise serviceapi.authwise.comadmin.authwise.comhttps://admin.authwise.com/oauth/tokena-01
Your own installA host from the install’s networking.api.hosts. See Reach the Admin API.spec.bootstrap.admin.issuerHosthttps://ADMIN_HOST/oauth/tokena-01

The token URL and the audience are what a service account credential needs; a browser login needs only the first two. The admin issuer host serves the sign-in and the token endpoint, not the Admin API: a call to admin.authwise.com:443 as the endpoint fails with 405 Method Not Allowed.

Your tenant’s ID (t-…) is in the console’s address bar when you open the tenant, as /tenants/TENANT_ID, and in the mint dialog of a service account.

The first profile you create is active. Profiles live in ~/.awctl.d/config.yaml, created with mode 0600. A profile never holds a credential.

A profile has these settings. Each one has an environment variable that overrides it:

FlagEnvironment variableSetting
--endpointAWCTL_ENDPOINTThe Admin API, as HOST:PORT.
--guard-endpointAWCTL_GUARD_ENDPOINTGuard’s control plane, for awctl guard.
--audit-endpointAWCTL_AUDIT_ENDPOINTThe estate audit server’s retrieval endpoint, for awctl audit.
--auth-issuerAWCTL_AUTH_ISSUERThe admin issuer that awctl auth login uses.
--insecureAWCTL_INSECURE=truePlaintext gRPC, for development endpoints such as a port-forward to the api Service.

To add another install, create another profile. To switch to it, activate it:

Terminal window
awctl config profiles create staging --endpoint STAGING_API_HOST:443 \
--auth-issuer https://STAGING_ADMIN_HOST
awctl config profiles activate staging
awctl config profiles list

list marks the active profile with *. STAGING_API_HOST and STAGING_ADMIN_HOST are the second install’s hosts.

To run one command against a profile without activating it, pass --profile, or set AWCTL_PROFILE for a shell session. Two terminals can use two installs at once this way:

Terminal window
awctl --profile prod identity realms list

awctl config profiles describe shows the profile in use, contexts included. update PROFILE changes the settings you pass, and delete PROFILE removes a profile other than the active one.

A context stores the scope identifiers you would otherwise pass on every command. Each command group has its own context inside the profile, so switching profile switches the context too, and an identifier from one install never fills in a command against another.

Terminal window
awctl identity context set --tenant TENANT_ID --issuer ISSUER_ID
awctl identity realms list # --tenant-id comes from the context
awctl identity context set --realm REALM_ID
awctl identity users list # --tenant-id and --realm-id
awctl identity context show

TENANT_ID, ISSUER_ID, and REALM_ID are the AWIDs of the tenant, issuer, and realm you work in, such as t-01.

GroupLevels context set stores
identity--tenant, --issuer, --realm, --audience
accessThe same context as identity: awctl access context is an alias.
guard--tenant (the tenant that has Guard enabled, the same t-… as identity), --network
auditNone. --tenant is always explicit.

A client is never stored: --client-id is what a command is about, not a scope you work inside. context set changes only the levels you pass, so setting --tenant keeps the stored realm; run context show after you switch tenants. context clear --realm clears one level, and context clear with no flags clears the group’s context.

For each value, an explicit flag wins, then the environment variable, then the profile. When a value is missing, the error names the flag and the context set command that stores it. A full resource name, such as tenants/t-01/realms/r-01, needs no context.

When a command that changes something takes scope from the context, it prints that scope to stderr before it runs, if stderr is a terminal:

scope from profile prod: tenant t-01, realm r-01

Reads print nothing, and nothing prints when stderr is redirected.

A CI job needs no profile. Set the endpoint and the client-credential variables in the environment, and pass every scope flag explicitly:

Terminal window
export AWCTL_ENDPOINT=API_HOST:443
export AWCTL_TOKEN_URL=TOKEN_URL
export AWCTL_CLIENT_ID=CLIENT_ID
export AWCTL_CLIENT_SECRET=CLIENT_SECRET
export AWCTL_AUDIENCE=AUDIENCE_ID
awctl identity realms list --tenant-id TENANT_ID

The values come from a credential minted for automation. A tenant administrator mints one for a service account the tenant owns; an operator uses the install’s machine credential.

There are two ways to authenticate, and awctl picks one deterministically: if any client-credential variable is set, it uses the client-credentials grant and refuses to start if the set is incomplete; otherwise it uses the credential that a browser login stored.

For scripts, CI, and the first session on a fresh install, use the machine credential the operator minted at install. It is an OAuth 2.0 client_credentials client in the install’s admin tenant; see Read the machine credential.

Terminal window
CREDENTIAL="$(kubectl -n NAMESPACE get secret CR_NAME-admin-credential \
-o jsonpath='{.data.credential\.json}' | base64 -d)"
export AWCTL_TOKEN_URL="$(jq -r .token_url <<<"$CREDENTIAL")"
export AWCTL_CLIENT_ID="$(jq -r .client_id <<<"$CREDENTIAL")"
export AWCTL_CLIENT_SECRET="$(jq -r .client_secret <<<"$CREDENTIAL")"
export AWCTL_AUDIENCE="$(jq -r .audience <<<"$CREDENTIAL")"
export AWCTL_ENDPOINT=API_HOST:443
awctl identity realms list --tenant-id TENANT_ID

NAMESPACE and CR_NAME are the install’s namespace and the name of its AuthwiseIdentityServer. AWCTL_AUDIENCE is the admin audience’s AWID, an identifier rather than a URL; pass it verbatim. Tokens are minted in process and re-minted before they expire.

awctl auth login runs the OAuth 2.0 authorization code flow with PKCE in your browser against the active profile’s --auth-issuer:

Terminal window
awctl auth login

Without a profile, pass the issuer: awctl auth login --issuer https://ADMIN_HOST. The issuer can also come from AWCTL_AUTH_ISSUER.

awctl signs in as the public CLI client that every install seeds, so a fresh install needs no client of your own. To sign in as another public client, pass --client-id CLIENT_ID, and allow the redirect URI that awctl auth login --show-redirect-uri prints, with the port dropped (http://localhost/return).

The access token is stored per issuer under ~/.awctl.d/credentials/, with mode 0600. Two profiles on one install share a login, and two installs never do. From 0.16, the login is renewed in the background: a short-lived access token is replaced through its refresh token for up to 12 hours of inactivity and 7 days in all, after which commands fail with a hint to run awctl auth login again. awctl auth logout deletes the login for the profile’s issuer.

Every verb takes --format table|yaml|json, with --yaml and --json as shorthands, and --fields a,b,c to choose columns. Tables hide sensitive fields; yaml and json do not. list pages through the whole collection automatically.

create and update take flags for the common fields, or --file PATH with a YAML or JSON document of the whole object. edit NAME opens the object in $EDITOR and sends the difference as a field-mask patch.

GroupScope flagsNotes
identity domains--tenant-idcreate --hostname HOST --custom [--wait] claims a hostname of your own and prints its two DNS records (awctl 0.40; a domain is identified by d-…, the hostname is a field); --product guard claims a custom Guard address instead; get, list with kind and state, delete (refused while an issuer is bound to it). create --issuer ISSUER_ID is deprecated: it claims the host and binds that issuer at its root for one release. See Use your own domain. identity issuer-domains is a deprecated alias.
identity issuer-domain-bindings--tenant-id --issuer-idcreate --domain HOST [--path PATH] binds the issuer at a path of a domain; list, describe, delete. Each binding is its own issuer URL.
identity issuers--tenant-idcreate needs no domain; --domain-id (the domain’s d-…) or --domain HOST with --path creates the first binding in the same step (deprecated). --preferred-binding (a binding id or hostname) chooses the host mailed links use. After create, domain_id, path and domain_name are output only and follow the issuer’s first binding. --config, --appearance-profile-id, --labels. --domain-name is deprecated.
identity realms--tenant-id
identity audiences, clients, appearance-profiles--tenant-id --issuer-idA client takes --audience-id, --display-name, --grant-type, --application-url, --login-url, --post-logout-redirect-uris, --config.
identity client-secrets--tenant-id --issuer-id --client-idNo create; mint prints the secret once.
identity users, providers, factors--tenant-id --realm-idUsers also have invite, list-authenticators, revoke-authenticator, list-devices, revoke-device, list-identifiers, remove-identifier.
identity scopes--tenant-id --issuer-id --audience-idcreate ID; add-, remove-, list-access-permissions.
identity themes, assets, certificates, secrets, endpoints--tenant-idCertificates: import, rotate, export. Secrets: create, add-version. Endpoints: check, referrers.
identity events--tenant-idRead only: list, describe.
access access-permissions, access-roles, access-conditions, access-bindings--tenant-id --issuer-id --audience-idRoles: add-, remove-, list-access-permissions.

awctl identity providers import-saml-metadata and export-saml-metadata exchange SAML metadata with an identity provider; awctl identity clients has the same pair for the service-provider side.

Create a realm and list the realms in a tenant:

Terminal window
awctl identity realms create --tenant-id TENANT_ID --display-name Employees
awctl identity realms list --tenant-id TENANT_ID

Mint a client secret and capture it without it reaching your terminal:

Terminal window
awctl identity client-secrets mint \
--tenant-id TENANT_ID --issuer-id ISSUER_ID --client-id CLIENT_ID \
--out ./client-secret.txt

--out writes the secret to a file with mode 0600 and refuses to overwrite. The secret is shown once; there is no way to read it again, only to mint a successor.

Invite a person into a realm, from awctl 0.15. They get an email with a link to set their password:

Terminal window
awctl identity users invite dana@acme.example \
--tenant-id TENANT_ID --realm-id REALM_ID --display-name "Dana Reyes"

The command prints the new user and whether the invitation was mailed. When it was not, because the install has no message delivery configured or the address was refused, it prints the reason and the accept URL for you to pass on; the URL sets the person’s password, so treat it like one. --json always includes it. --reissue replaces a live invitation and voids the earlier link.

Read an issuer’s configuration as JSON and inspect one field:

Terminal window
awctl identity issuers describe ISSUER_ID --tenant-id TENANT_ID --json \
| jq .config

Check an outbound endpoint and see what references it:

Terminal window
awctl identity endpoints check ENDPOINT_ID --tenant-id TENANT_ID
awctl identity endpoints referrers ENDPOINT_ID --tenant-id TENANT_ID

check exits non-zero when the endpoint is unreachable, which suits a readiness script.

List recent events in a tenant:

Terminal window
awctl identity events list --tenant-id TENANT_ID
  • Secrets go through files or stdin, never flags. identity secrets create reads material from --data-file PATH or from stdin with -. Use printf '%s' rather than echo to avoid sending a trailing newline as part of the secret.
  • --config on an issuer replaces the whole config. The server refuses a partial update beneath the realm selector, so read the config, edit it, and write it back whole.
  • ALREADY_EXISTS on an access binding means the same audience, subject, role, resource, and condition already have a binding. Expiry is not part of that identity, so extending a grant is an update, not a second create.
  • Deletion is refused while referenced. An endpoint, certificate, or issuer that something still references cannot be deleted; endpoints referrers names the holders.
  • Revoking a user’s authenticator also revokes their remembered browsers. The revoke and remove verbs prompt unless you pass --yes, and refuse to run without a terminal and without it.
  • awctl works inside a tenant. It does not create tenants or grant operator status; those belong to the operator-only tenancy surface.