keycloak
CLI for Keycloak, an open-source identity and access management
TLDR
Start Keycloak in development mode
SYNOPSIS
kc.sh command [options]
DESCRIPTION
kc.sh is the CLI for Keycloak, an open-source identity and access management solution. It manages server lifecycle, configuration, and data import/export.
Development mode (start-dev) runs with relaxed security for local testing. Production deployments use start after running build to optimize configuration. The build step creates a quarkus-based optimized distribution.
Keycloak supports SAML 2.0, OpenID Connect, OAuth 2.0, and LDAP/AD integration. It provides features like social login, user federation, fine-grained authorization, and multi-factor authentication.
The export and import commands transfer realm configurations including clients, roles, users, and authentication flows. Use these for backup, migration, or infrastructure-as-code workflows.
Configuration can be provided via command-line options, environment variables (KC_ prefix), or configuration files.
PARAMETERS
--hostname name
Public hostname for the server.--hostname-admin name
Hostname for admin console.--http-port port
HTTP listen port. Default: 8080.--https-port port
HTTPS listen port. Default: 8443.--db type
Database vendor: dev-file, dev-mem, postgres, mysql, mariadb, mssql, oracle.--db-url url
Full database JDBC URL.--db-username user
Database username.--db-password pass
Database password.--features list
Enable feature flags.--health-enabled bool
Enable health endpoints.--metrics-enabled bool
Enable metrics endpoint.--proxy mode
Proxy mode: edge, reencrypt, passthrough.--log-level level
Log level: fatal, error, warn, info, debug, trace.--help, -h
Display help information.
COMMANDS
start
Start server in production mode (requires build).start-dev
Start in development mode with defaults.build
Generate optimized server configuration.export
Export realm data to file.import
Import realm data from file.show-config
Display current configuration.tools
Utility commands for completions and vault operations.
CAVEATS
Production mode requires explicit hostname configuration and TLS setup. The build command must run before production start when configuration changes. Some options require restart. Database configuration differs significantly between development (H2) and production deployments.
HISTORY
Keycloak was created by Red Hat and first released in September 2014. It originated from PicketLink and became Red Hat's strategic identity solution. The project joined CNCF as an incubating project in 2023. Version 17 (2022) introduced Quarkus-based architecture replacing WildFly. Keycloak is widely deployed for enterprise SSO, API security, and user management.
