External Identity Provider Setup⚓︎
This guide explains how to configure external identity providers (IdPs) with prokube.
Overview⚓︎
prokube uses Keycloak as its identity broker. You can federate Keycloak with external identity providers to:
- Allow users to sign in with their corporate credentials
- Centralize user management in your existing IdP
- Enable Single Sign-On (SSO) across your organization
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Browser │────▶│ Keycloak │────▶│ External IdP│
│ │ │ (broker) │ │ │
└─────────────┘ └─────────────┘ └─────────────┘
Example: Microsoft Entra ID
This guide uses Microsoft Entra ID (Azure AD) as a detailed example. The same principles apply to other OIDC-compatible identity providers like Google Workspace, Okta, or any generic OIDC provider. See Other Identity Providers for brief setup notes on alternatives.
Microsoft Entra ID (Azure AD) Example⚓︎
Prerequisites⚓︎
- Access to the Azure Portal with permissions to create App Registrations
- Admin access to the Keycloak prokube realm
- Your prokube domain (e.g.,
https://cluster.example.com)
Step 1: Create Azure App Registration⚓︎
- Go to the Azure Portal
- Navigate to Microsoft Entra ID → App registrations
-
Click New registration
Field Value Name prokube-sso(or your preferred name)Supported account types Choose based on your needs (single tenant recommended) Redirect URI Platform: WebURI:https://<your-domain>/auth/realms/prokube/broker/microsoft/endpoint -
Click Register
Step 2: Configure Azure App⚓︎
After registration, configure the app:
Client Secret⚓︎
- Go to Certificates & secrets → Client secrets
- Click New client secret
- Add a description and choose expiration
- Copy the secret value immediately (it won't be shown again)
API Permissions⚓︎
- Go to API permissions
- Click Add a permission → Microsoft Graph
- Select Delegated permissions
- Add these permissions:
openidprofileemailUser.Read(selected by default, for retrieving user info)- Click Grant admin consent (if required by your organization)
Step 3: Configure Keycloak⚓︎
- Access Keycloak admin console at
https://<your-domain>/auth/admin/prokube/console -
Go to Identity Providers → Add provider → Microsoft
-
Configure the provider:
Field Value Alias microsoftDisplay Name Microsoft(shown on login page)Client ID From Azure App Registration → Overview Client Secret From Step 2 Prompt select_account(Important: Prevents "Admin Approval Needed" errors)Tenant ID From Azure App Registration → Overview (Directory ID) (Important: Required for Single-Tenant Accounts) -
Click
Add
Advanced Settings⚓︎
After clicking Add the newly added provider will open in Provider details section.
Go to Advanced Settings section on the right and configure:
| Field | Value | Notes |
|---|---|---|
| Scopes | openid profile email User.Read |
Required for retrieving user profile and email from Entra ID (Defaults to only openid) |
| Trust Email | On |
Trust email verification from Entra ID |
| Sync mode | import |
Creates Keycloak users on first login |
Click Save.
Step 4: Test the Integration⚓︎
- Open a new incognito/private browser window (to avoid existing sessions)
- Go to
https://<your-domain>/ - Click Microsoft on the login page
- Sign in with your Entra ID credentials
- Verify you can access the prokube dashboard
Note
Keycloak creates a corresponding new Keycloak user on first external IdP login.
The corresponding Keycloak user can be seen on Users page in Keycloak admin console.
The user automatically gets assigned to the pk-user group.
Further role/group assignments can be managed in Keycloak as needed.
Troubleshooting⚓︎
"Admin Approval Needed" Error⚓︎
Cause: Entra ID tenant requires admin consent for new apps.
Solution:
1. In Keycloak, go to Identity Providers → Microsoft → Advanced Settings
2. Set Prompt to select_account
3. Save and try again
Alternatively, have your Azure AD admin grant consent for the app.
User Not in pk-user Group⚓︎
Cause: Default group not configured or user created before configuration.
Solution:
1. Sign in as Keycloak master admin at https://<your-domain>/auth/admin/master/console. Only Keycloak master admins can manage the following realm settings.
2. Go to Manage realms → Select prokube realm
3. Go to Realm Settings → User registration -> Default groups
4. Verify pk-user is set as a default group
5. For existing users that are not in pk-user group, manually add them to pk-user:
- Go to Users → Select user → Groups → Join Group → pk-user
"Email Not Verified" Error (500)⚓︎
Cause: Keycloak requires verified emails but Entra ID didn't provide verification status.
Solution:
1. In Keycloak, go to Identity Providers → Microsoft → Advanced Settings
2. Set Trust Email to On
3. Save and have the user try again
"Invalid redirect_uri" Error⚓︎
Cause: Redirect URI mismatch between Azure and Keycloak.
Solution: 1. In Azure Portal, go to App Registration → Authentication 2. Verify the redirect URI matches exactly:
https://<your-domain>/auth/realms/prokube/broker/microsoft/endpoint
"AADSTS50194: Application 'xxxxxxxx' is not configured as a multi-tenant application" Azure Error⚓︎
Cause: Azure app is single-tenant but Keycloak is not configured with tenant ID.
Solution: 1. In Keycloak, go to Identity Providers → Microsoft -> General Settings (Opens as default tab) 2. Set Tenant ID to the Directory ID from Azure App Registration → Overview 3. Save and try again
Other Identity Providers⚓︎
Google Workspace⚓︎
Similar setup process:
- Create OAuth 2.0 credentials in Google Cloud Console
- Add Google identity provider in Keycloak
- Configure scopes:
openid email profile - Set up claim mappers
Okta⚓︎
- Create OIDC application in Okta
- Add OpenID Connect v1.0 identity provider in Keycloak
- Configure client ID, secret, and issuer URL
- Set up claim mappers
Generic OIDC⚓︎
For any OIDC-compliant provider:
- In Keycloak, go to Identity Providers → Add provider → OpenID Connect v1.0
- Configure:
- Authorization URL
- Token URL
- Client ID and Secret
- Default Scopes
- Add claim mappers as needed
Security Considerations⚓︎
- Use HTTPS everywhere - All redirect URIs must use HTTPS
- Rotate client secrets - Set calendar reminders before expiration
- Limit scopes - Only request necessary permissions
- Monitor logins - Enable Keycloak event logging
- Require 2FA - Configure in both Entra ID and Keycloak authentication flows