هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
ماذا يفعل
Keycloak gives single sign-on (OIDC, OAuth 2.0, SAML) for apps, Grafana, Argo CD, Kubernetes dashboards and more, with MFA, user federation (LDAP/AD) and identity brokering (Entra ID, GitHub). kcadm.sh (in bin/ of the Keycloak folder or container) calls the admin REST API, so you can create realms, clients and users in automation.
A realm is a separate space of users and apps; a client is an app that uses Keycloak to log users in.
طريقة الكتابة
kcadm.sh COMMAND ENDPOINT [-r REALM] [-s key=value ...] [ARGS]الأجزاء الرئيسية
Commands
configcredentials- Log in to the server.
createENDPOINT- Create (realms, users, clients, roles).
getENDPOINT- Read.
updateENDPOINT- Change.
deleteENDPOINT- Delete.
set-password- Set a user password.
add-roles/remove-roles- Give or take roles.
get-roles- Show roles.
الخيارات 8
الأكثر استخدامًا
Flags
لا يوجد شيء يطابق هذا الفلتر.
أمثلة 11
$ مستخدم عادي# بصلاحية root (أو مع sudo)
1Run Keycloak in a container for the lab
podman run -d --name keycloak -p 8080:8080 -e KC_BOOTSTRAP_ADMIN_USERNAME=admin -e KC_BOOTSTRAP_ADMIN_PASSWORD=ChangeMe! quay.io/keycloak/keycloak:26.0 start-dev2Log in with the CLI
podman exec -it keycloak bash /opt/keycloak/bin/kcadm.sh config credentials --server http://localhost:8080 --realm master --user admin3Create a realm with brute-force protection
kcadm.sh create realms -s realm=lab -s enabled=true -s bruteForceProtected=true -s 'passwordPolicy="length(12) and notUsername"'4Create a user and set a password
kcadm.sh create users -r lab -s username=hosam -s enabled=true -s email=hosam.test@example.com kcadm.sh set-password -r lab --username hosam --new-password 'Temp-Pass-2026!' --temporary5Create an OIDC client for Grafana
kcadm.sh create clients -r lab -s clientId=grafana -s protocol=openid-connect -s publicClient=false -s 'redirectUris=["https://grafana.lab.local/login/generic_oauth"]' -i6Read the client secret
kcadm.sh get clients -r lab -q clientId=grafana --fields id kcadm.sh get clients/3f2a91c0-1d2e-4f5a-9b8c-7d6e5f4a3b2c/client-secret -r lab7Create a group and a role, give the role
kcadm.sh create groups -r lab -s name=sre kcadm.sh create roles -r lab -s name=admin kcadm.sh add-roles -r lab --uusername hosam --rolename admin8Require OTP for all users
kcadm.sh update authentication/required-actions/CONFIGURE_TOTP -r lab -s defaultAction=true9List users
kcadm.sh get users -r lab --fields username,enabled,email10Check the OIDC discovery document
curl -s http://localhost:8080/realms/lab/.well-known/openid-configuration | jq '.issuer, .token_endpoint'11Export a realm for Git (in the container)
/opt/keycloak/bin/kc.sh export --dir /tmp/export --realm lab
لا يوجد شيء يطابق هذا الفلتر.
انتبه
start-devis only for labs (HTTP, no cache cluster). Production needsstartwith TLS and a database.- Change the bootstrap admin, enable MFA for admins, and do not expose
/adminpublicly.
الملفات
~/.keycloak/kcadm.config- CLI login token.
نصائح للحفظ
- Manage realms as code with the Keycloak Terraform provider or keycloak-config-cli.
رموز الخروج
0 | Success. |
1 | Error. |