Microsoft Entra ID SSO for AlmaForge
Last verified: December 1, 2026
Connect AlmaForge to Microsoft Entra ID (formerly Azure Active Directory) with OpenID Connect (OIDC) and map Entra security groups to AlmaForge roles. Users sign in with their Microsoft organizational account and receive roles from their current group memberships.
Prerequisites
AlmaForge cluster
Use a running cluster. If you already have an admin CLI profile, run this on your workstation and confirm the active profile points to your cluster.
alma statusIf Entra ID will be your first SSO connector, use the local admin identity on the Auth Service host to apply it. See Connect your first identity provider.
Have the public HTTPS address of the Proxy Service ready. You will use its hostname to build the Entra ID redirect URI.
Microsoft Entra ID administrator
You need an Entra ID administrator account with permission to register applications and inspect security groups. The Application Administrator, Cloud Application Administrator, or Global Administrator directory roles cover all required permissions.
Have your Directory (tenant) ID ready. Find it on the Overview page in the Entra admin center or with the Azure CLI:
az account show --query tenantId -o tsvEntra security groups
Have at least one Entra ID security group ready to map to AlmaForge roles. AlmaForge matches each group by its immutable Object ID (UUID), not its display name. Copy each group's Object ID from its Overview page in the Entra admin center.
Use a direct member of a mapped group for the first sign-in test.
Network access from Auth Service hosts
The Auth Service uses login.microsoftonline.com to discover Entra's OIDC
configuration, verify token signatures, and exchange authorization codes for
tokens. Allow outbound HTTPS (TCP port 443) from every Auth Service host to this
endpoint.
Run this check from each Auth Service host.
curl -sS --max-time 10 -o /dev/null \ -w "login.microsoftonline.com: HTTP %{http_code}\n" \ "https://login.microsoftonline.com/"An HTTP response confirms connectivity. If curl reports HTTP 000, check DNS,
firewall, proxy, or TLS settings before continuing.
Step 1. Configure Microsoft Entra ID with Terraform
If you do not use Terraform, follow Entra admin center setup below instead.
Save
almaforge-microsoft-entra-sso.tf
in a new private working directory. It creates a single-tenant app registration
with the callback URI, adds the groups claim to ID tokens, creates the
enterprise application and client secret, and creates the AlmaForge-Admins
and AlmaForge-Developers security groups. Keep Terraform state, state backups,
and exported secrets out of source control.
Authenticate with the Azure CLI, replace almaforge.example.com with your
public Proxy Service hostname, and apply:
umask 077az loginterraform initterraform apply -var='proxy_public_addr=almaforge.example.com'terraform output -raw tenant_idterraform output -raw application_idterraform output group_object_idsterraform output -raw client_secret > microsoft-secret.txtContinue to Step 2. You will install
microsoft-secret.txt and map the group_object_ids output to AlmaForge
roles.
Step 1. Configure Microsoft Entra ID in Entra admin center
Use this section if you do not use Terraform. If you already provisioned Entra ID with Terraform above, skip to Step 2.
Step 1.1. Register the application
-
Sign in to the Microsoft Entra admin center.
-
Open Entra ID → App registrations and click New registration.
-
Set these fields.
- Name:
AlmaForge SSO - Supported account types: Single tenant only (accounts in your organizational directory only).
- Redirect URI: Select Web and enter
https://almaforge.example.com/api/v1/oidc/callback. Replacealmaforge.example.comwith your public Proxy Service hostname. Keephttps://, omit:443, and omit the trailing slash.

- Name:
-
Click Register.
-
On the application Overview page, copy the Application (client) ID and Directory (tenant) ID.
Step 1.2. Create a client secret
-
In the application sidebar, open Manage → Certificates & secrets.
-
Open the Client secrets tab and click New client secret.

-
Enter a description (for example,
AlmaForge Auth Service), choose an expiration period that matches your rotation policy (Entra ID caps client secrets at 24 months), and click Add. -
Copy the Value column before leaving the page. Entra ID masks the secret as soon as you leave and never shows it again. Do not copy the Secret ID column.
Anyone with the client secret can impersonate AlmaForge to Entra ID's OAuth endpoints. Store it in the same secret manager you use for production credentials. Do not commit it to Git.
Step 1.3. Configure the groups claim
Entra ID does not include group memberships in ID tokens by default. Configure
the app registration to emit security group Object IDs in the groups claim so
AlmaForge can map them to roles in Step 2:
-
In the application sidebar, open Manage → Token configuration.
-
Click Add groups claim.
-
Under Select group types to include in Access, ID, and SAML tokens, select Security groups. If a user belongs to more than 200 groups, Entra ID omits the
groupsclaim from the ID token and emits a Graph overage pointer that AlmaForge does not follow. For users who exceed this limit, select Groups assigned to the application and assign only the groups needed for AlmaForge access. This option requires Microsoft Entra ID P1 or a license that includes it.
-
Under Customize token properties by type, expand ID, keep Group ID selected so Entra ID emits immutable Object IDs rather than display names, and leave Emit groups as role claims unchecked.

-
Click Add (or Save). Confirm that
groupsappears in the Optional claims table with ID listed under Token type.
Step 2. Apply the OIDCConnector
Store the client secret in a root-only file on each Auth Service host.
almad runs as root, so only root needs read access to the file.
sudo install -o root -g root -m 0600 /dev/stdin /etc/almaforge/microsoft-secret.txt <<'EOF'<client-secret-value>EOFIn a multi-node Auth Service cluster, every host needs an identical secret file at this exact path. The instance that handles a login reads the file locally. See High availability to prevent intermittent login failures.
Write a YAML file describing the connector. Set clientSecret to a
${file:PATH} reference so the Auth Service reads the secret from disk, and
map Entra's groups claim Object IDs to AlmaForge roles under
claimsToRoles:
# Microsoft Entra ID connector loading clientSecret from a local file.
apiVersion: almaforge.com/v1
kind: OIDCConnector
metadata:
name: microsoft
spec:
display: Microsoft
provider: microsoft
issuerURL: https://login.microsoftonline.com/<tenant-id>/v2.0
clientID: <application-client-id>
clientSecret: ${file:/etc/almaforge/microsoft-secret.txt}
usernameClaim: preferred_username
# Use each group's Object ID (UUID) from Entra ID under value, not its
# display name, and list existing AlmaForge roles.
claimsToRoles:
# AlmaForge-Admins
- claim: groups
value: <admins-group-object-id>
roles: [admin, access]
# AlmaForge-Developers
- claim: groups
value: <developers-group-object-id>
roles: [access]
Replace:
<tenant-id>with the Directory (tenant) ID from Step 1 (or Step 1.1).<application-client-id>with the Application (client) ID from Step 1 (or Step 1.1).- The path inside
${file:...}with the path where you installedmicrosoft-secret.txton every Auth Service host. <admins-group-object-id>and<developers-group-object-id>with your Entra security group Object IDs (UUIDs from each group's Overview page). A display name such asAlmaForge-Adminswill not match. Keep the group name in a comment above each entry so the mapping stays readable.
These fields are specific to Entra ID:
issuerURLuses the tenant-specific v2.0 endpoint. The token'sissclaim must match this issuer.usernameClaim: preferred_usernamemaps the AlmaForge username to the Entra user principal name, such asalice@example.com, instead of the immutable subject ID.
Alternative: load the client secret from an environment variable or inline
clientSecret also accepts an environment variable reference
(${env:MICROSOFT_CLIENT_SECRET}) or an inline string. An inline value stores
the secret directly in the cluster state store, where it is returned by
alma get oidcconnector/microsoft -o yaml --with-secrets and included
in backend backups. Prefer ${file:PATH} or ${env:VAR} in production. See
Secret storage.
AlmaForge has no local accounts. If this is the only connector, a wrong claim mapping or expired client secret prevents new logins. Confirm your break-glass procedure works before applying the connector to a production cluster.
If you have a cluster admin profile, apply the connector from your workstation.
alma apply -f microsoft.yamlIf this is your first connector, copy microsoft.yaml to the Auth Service host
and apply it there using the local admin identity.
sudo alma apply -f microsoft.yamlStep 3. Verify the connector
Open the cluster's audit log for your test account. See SSO verification for event fields and the distinction from service logs.
Keep your admin session open. From a separate workstation or OS account, sign in as a direct member of a mapped Entra security group. Replace the example proxy address with yours.
alma login --proxy=almaforge.example.comChoose Microsoft in the browser. The test passes when alma prints
the roles expected for that user.
If this is the cluster's first connector, also sign in with an account mapped to
admin. Confirm that alma prints the admin role before closing the
local admin session on the Auth Service host.
Audit events from a successful sign-in
A successful first-time login emits a UserLogin event and the
CertificateCreate event for the certificate it mints:
{
"kind": "AuditEvent",
"apiVersion": "almaforge.com/v1",
"spec": {
"id": "1a2b3c4d-5e6f-4071-8293-a4b5c6d7e8f9",
"index": 0,
"timestamp": "2026-03-30T15:58:58.999000Z",
"clusterName": "almaforge.example.com",
"code": "T1001I",
"type": "UserLogin",
"verb": "login",
"actor": {
"name": "alice@example.com",
"type": "user"
},
"status": {
"success": true
},
"userLogin": {
"method": "oidc",
"attributes": {
"connector_id": "microsoft",
"connector_type": "oidc",
"name": "Alice Example",
"request_id": "8f0c1e6a-2f7e-4a7a-9f1e-1f0b6d0f1a2b",
"username": "alice@example.com"
}
}
}
}
{
"kind": "AuditEvent",
"apiVersion": "almaforge.com/v1",
"spec": {
"id": "6d7e8f90-a1b2-43c4-95d6-e7f8091a2b3c",
"index": 0,
"timestamp": "2026-03-30T15:58:58.999000Z",
"clusterName": "almaforge.example.com",
"code": "TC000I",
"type": "CertificateCreate",
"verb": "create",
"certificateCreate": {
"certType": "user",
"identity": {
"user": "alice@example.com",
"roles": [
"admin",
"access"
],
"logins": [
"tester",
"ec2-user",
"root"
],
"traits": {
"groups": [
"11111111-1111-1111-1111-111111111111",
"22222222-2222-2222-2222-222222222222"
],
"name": [
"Alice Example"
],
"preferred_username": [
"alice@example.com"
]
}
}
}
}
}
Check these fields on the CertificateCreate event:
spec.certificateCreate.identity.traits.groups: the group Object IDs Entra ID emitted in the ID token. Compare these UUIDs with yourclaimsToRolesentries. Ifgroupsis missing, thegroupsclaim was not configured in Step 1.3 or the user exceeded the 200-group overage limit.spec.certificateCreate.identity.traits.preferred_username: compare withspec.certificateCreate.identity.userto confirmusernameClaim.spec.certificateCreate.identity.rolesandlogins: confirm the expected roles and SSH logins.
Read the full audit-event breakdown on the generic OIDC verification section.
Troubleshooting
AADSTS50011: reply URL does not match
The Redirect URI registered in
Step 1.1 does not match the URL
AlmaForge sends as redirect_uri. Open the app registration in the Entra
admin center, select Authentication, and verify that the Web platform
contains https://<proxy-public-addr>/api/v1/oidc/callback with exact casing,
port 443 omitted, and no trailing slash.
Login fails with invalid_client
The client secret on the connector does not match what Entra ID has on file.
Common causes are copying the Secret ID instead of the Value, rotating
the secret in Entra without updating /etc/almaforge/microsoft-secret.txt on
every Auth Service host, or letting the secret expire (Entra secrets cap at 24
months). Generate a new secret under Certificates & secrets, copy the
Value column, and follow Client secret rotation.
No roles match the login
The login is rejected when no mapping assigns a role. Check these conditions first:
- Every
claimsToRolesvalue is the group's Object ID (UUID), not its display name. - Under Token configuration in the app registration, a groups claim exists with ID → Group ID selected.
With ALMA_LOG_LEVEL=debug on the Auth Service host, sign in again and inspect
the claims Entra ID sent:
journalctl -u almad -f | grep 'Extracted claims'Every claimsToRoles value must exactly match an Object ID in the emitted
groups array. After a successful login, inspect
spec.certificateCreate.identity.traits.groups in the CertificateCreate
audit event. See Claims, traits, and role templates.
Admin group missing for a user with many groups
When a user belongs to more than 200 groups, Entra ID omits the groups claim
from the ID token and emits _claim_names and _claim_sources pointers to
Microsoft Graph instead. AlmaForge does not currently follow the overage
pointer.
Under Token configuration → Edit groups claim, switch to Groups assigned
to the application, then assign each required security group to the Enterprise
Application. Users must be direct members of those assigned groups because this
option excludes nested membership. Assigning groups to an enterprise
application requires Microsoft Entra ID P1 or a license that includes it.
Reducing claimsToRoles in AlmaForge does not reduce the groups Entra emits. See
Microsoft's group-claim guidance.
AADSTS700016: Application not found in directory
The clientID in microsoft.yaml does not match the app registration, or
issuerURL contains the wrong tenant ID. Compare both values with the
application's Overview page in the Entra admin center.
Operations
Break-glass access
Test break-glass access before relying on this
connector. Entra-specific recovery cases include an expired client secret, a
misconfigured groups claim, or an Entra ID outage.
Revocation
Removing a user from an Entra security group takes effect on their next sign-in. Existing certificates remain valid until they expire. For an immediate cutoff, lock the user.
Secret storage
Use ${file:PATH} or ${env:VAR} to keep clientSecret out of the cluster
state store and its backups. Follow Secret storage
to protect secrets in production.
Client secret rotation
Entra ID caps client secrets at 24 months. An app registration can hold multiple active secrets, so you can rotate one without downtime:
- In the app registration, open Manage → Certificates & secrets → Client secrets and click New client secret. Do not delete the old secret yet.
- Copy the new secret's Value column immediately.
- Replace
/etc/almaforge/microsoft-secret.txton every Auth Service host using your configuration management tool (Ansible, Puppet, cloud-init, or Kubernetes secret mounts). - Confirm a test login works through
alma login. - Delete the old secret in Entra ID.
The connector reads the file on the next login. No almad restart is
required. If you configured an inline clientSecret, re-apply the connector
with the new value. Track the expiration date in your alerting system because
Entra ID does not alert when a secret expires.
Lifecycle
Apply connector changes before testing the next login. No almad
restart is needed. See
When connector changes take effect
for discovery caching and IdP-side changes.
High availability
AlmaForge reads /etc/almaforge/microsoft-secret.txt on the Auth Service
instance that handles each login callback. In a multi-node Auth Service cluster,
a missing or stale file on one instance causes intermittent login failures.
Deploy the file through configuration management so every Auth Service host has
an identical copy at the same path with mode 0600.
Every Auth Service instance also calls login.microsoftonline.com independently
and caches the OIDC discovery document for one hour. See
High availability on the generic OIDC page for
the full list of per-instance assumptions.
Monitoring
Monitor the audit log for login outcomes. For diagnostics, inspect the Auth journal for token validation and the Proxy journal for browser callbacks. On each service host, tail OIDC-related messages with:
journalctl -u almad -f | grep -Ei 'microsoft|oidc'Check UserLogin failures and their spec.status.error field. See
SSO verification for event codes,
certificate fields, and debug-only journal copies. Collect records from
audit event storage for SIEM ingestion.
Collect service diagnostics from the journal separately.
Removal
Delete the connector resource:
alma delete oidcconnector/microsoftExisting sessions issued through the connector remain valid until their certificates expire. No new sessions will be issued.
On the Entra side, remove /etc/almaforge/microsoft-secret.txt from Auth
Service hosts and delete the app registration in Microsoft Entra ID so the
client ID and secret can no longer be used.
References
OIDCConnectorresource referenceAuthConfigresource reference- Generic OIDC integration guide
- Break-glass access guide
- Microsoft: Register an application with the Microsoft identity platform
- Microsoft: Configure group claims for applications with Microsoft Entra ID
- Microsoft: Configure group claims in tokens (overage guidance)