kilork.github.io

keycloak-cli

Every admin operation as a command, generated from the crate.

keycloak-cli output: a clients table, a dry-run delete, and the --yes guard

Keycloak's admin API has 415 operations. kcadm.sh covers the useful-looking ones; for everything else you end up writing curl with a token you fetched by hand, and typing the same realm and URL shape again next week.

This is the whole thing as commands, named after the API path and verb, so clients list, users role-mappings realm get and organizations invitations resend all just exist.

What changes for you

Getting it

curl -fsSL https://raw.githubusercontent.com/rust-utility/keycloak-cli/main/install.sh | sh
keycloak-cli self-update --check

The installer downloads the binary for your platform (macOS arm64/x86_64, static musl Linux aarch64/x86_64), checks it against the release's SHA256SUMS and installs it. keycloak-cli self-update does the same from the CLI. cargo install keycloak-cli works as well.

A five-line script

keycloak-cli login
for c in $(keycloak-cli clients list --fields clientId | tail -n +2); do
  keycloak-cli clients get "$c"
done
keycloak-cli logout

Where to look

source · crate · docs · roadmap