How To Upgrade: Keycloak Realm Management chart
This page describes upgrade considerations for the keycloak-realm-management chart.
Keycloak version compatibility
The realm management chart renders configuration for a specific version of Keycloak. Some realm fields are version-gated; they are only emitted when the target Keycloak version supports them.
When upgrading Keycloak, ensure the keycloak-config-cli image version used during import matches the Keycloak version you are importing into. Mismatched versions can cause keycloak-config-cli to reject or silently drop unsupported fields.
The Keycloak version used for import is controlled by the KEYCLOAK_CONFIG_CLI_IMAGE variable in the Makefile. Update this value when upgrading Keycloak.
Re-applying after a Keycloak upgrade
After upgrading Keycloak, re-import all realm components to ensure that any new version-gated fields (e.g. new security policies, updated token settings) are applied to the existing realms:
make import \
KEYCLOAK_URL=https://keycloak.example.com \
KEYCLOAK_USER=admin \
KEYCLOAK_PASSWORD=<admin_password>
All imports are idempotent and non-destructive, re-applying is always safe.
Incremental realm updates (production workflow)
In production environments, realm updates should be applied using the keycloak-config-cli service account instead of admin credentials. This avoids storing or transmitting admin passwords and allows updates to be automated in CI/CD pipelines.
Using the service account (import-*)
The import-* Makefile targets authenticate via OAuth2 client_credentials grant using the keycloak-config-cli client created during setup (see Customer Keycloak via CLI or the equivalent bootstrap step for managed Keycloak installations).
# Update the mia-platform realm
make import-products \
ENV=production \
KEYCLOAK_URL=https://keycloak.example.com \
LOGIN_REALM=master \
KEYCLOAK_CLIENT_SECRET=<CLIENT_SECRET> \
VALUES=values/production/products-values.yaml
# Update the mia-platform-extensibility realm
make import-extensibility \
ENV=production \
KEYCLOAK_URL=https://keycloak.example.com \
LOGIN_REALM=master \
KEYCLOAK_CLIENT_SECRET=<CLIENT_SECRET> \
VALUES=values/production/extensibility-values.yaml
# Update the master realm
make import-master \
KEYCLOAK_URL=https://keycloak.example.com \
LOGIN_REALM=master \
KEYCLOAK_CLIENT_SECRET=<CLIENT_SECRET> \
VALUES=values/master-values.yaml
Using admin credentials (import-admin-*)
The import-admin-* targets authenticate with username and password. Use these only for emergency access or when the service account is not yet configured:
make import-admin-products \
ENV=production \
KEYCLOAK_URL=https://keycloak.example.com \
KEYCLOAK_USER=admin \
KEYCLOAK_PASSWORD=<admin_password> \
VALUES=values/production/products-values.yaml
Recommended update sequence
When a new version of the keycloak-realm-management chart is released:
- Review the
CHANGELOG.mdof the chart for renamed values, removed fields, or changed defaults that require values file updates. - Update dependencies:
make deps - Render without applying (dry-run):
make template-products ENV=production VALUES=... - Review the generated YAML in
rendered/production/products/<values-name>/to confirm the changes are as expected. - Apply:
make import-products ENV=production ...(repeat for each changed realm)
All imports are safe to run in any order and any number of times, the no-delete policy on all managed resource types ensures that removing an entry from a values file never deletes the corresponding resource in Keycloak.
Chart version migration notes
From 0.1.35 to 0.1.47 (Mia-Platform v15.1.1 to v15.2.0)
- If
products.authzis enabled, add the<realmId>_scim-client-secretentry (for examplemia-platform_scim-client-secret) to the Keycloak vault through the Keycloak chartvault.*values before you import the realm. The chart now always creates thescim-clientclient withproducts.authz: true, and the client reads its secret from${vault.scim-client-secret}. - If you install AI Services, set
products.aiServices: trueandurls.aiServicesto the public AI Services URL, which must match the URL configured in the AI Services chart. Before the import, also add the<realmId>_ai-services-temporal-ui-client-secretentry to the Keycloak vault. The chart then creates theai-services-api,ai-services-access-control,ai-services-temporal-uiandai-services-mcp-gatewayclients and adds themia:ai-servicesscope to the token exchange clients of the other products.
Also note:
- With
products.authz: true, the chart now creates theauthz-token-exchangeclient, used by the Homepage & RBAC chart to exchange tokens for the Catalog and AI Services. It offers themia:catalogscope only withproducts.catalog: trueand themia:ai-servicesscope only withproducts.aiServices: true. - With
products.aiFoundry: true, the chart now also creates theai-foundry-provisionerservice account client, which reads its keys from<urls.aiFoundry>/.well-known/ai-foundry-provisioner/jwks.json, and the publicai-foundry-cliclient. The provisioner client also uses themia:authz,mia:authz-rolesandmia:catalogscopes, so enableproducts.authzandproducts.catalogas well. - The
service-account-catalog-access-controlandcatalog-engineusers are now created only withproducts.catalog: true, andservice-account-ai-foundry-access-controlonly withproducts.aiFoundry: true. Users created by an earlier version stay in Keycloak. - The chart adds the
authz-apiclient rolesurn:mia-platform-internal:role:authz:principals:reader,urn:mia-platform-internal:role:authz:provisioning:groupsandurn:mia-platform-internal:role:authz:provisioning:users, and givesprincipals:readerto thecatalog-engineservice account. - The Keycloak version is unchanged: no newer Keycloak or Keycloak chart is required.
From 0.1.28 to 0.1.35 (Mia-Platform v15.0.2 to v15.1.0)
No manual action required: install the new chart version.
Also note:
- With
products.console: true, the chart now creates theurn:mia-platform-internal:role:console:guestclient role onconsole-api, maps it to themia:consoleclient scope, and creates theproducts/console/guestgroup also whenoptions.isPaaSisfalse. Check that these realm objects fit your access model. - The
products/authz/superadmingroup is now created only whenproducts.authzistrue. Groups use theno-deleteimport policy, so a group created by an earlier version stays in Keycloak but is no longer managed by the chart. - With
products.catalog: true, the chart creates thecatalog-engineservice account client and its service account user, with theurn:mia-platform-internal:role:authz:permissions:writerrole onauthz-api. Catalog uses this client to sync its permissions (see the Catalog upgrade notes). The client reads its keys from<urls.catalog>/.well-known/jwks.json, sourls.catalogmust point to the public Catalog URL. - With
products.flow: true, the chart creates theflow-access-controlservice account client and its service account user. - The Mia Flow clients now offer the optional client scope
mia:authzinstead ofmia:ai-foundry. - With
options.cimd: true, the Claude Code client also accepts the redirect URIhttps://claude.ai/api/mcp/auth_callback.
Future releases that require user action, such as renamed values, removed fields, or changed default behaviors, will include step-by-step migration instructions in this section. Always review the chart CHANGELOG.md before upgrading.