Entra ID on Linux
Sign Microsoft Entra ID users in to Linux for DefenseClaw with Azure Entra SSH sign-in, Himmelblau or Entra Domain Services, and get groups to the host.
Linux has three ways to sign Entra users in. Only two give the host the user's Entra groups, which a groups assignment needs. Entra ID support is Preview.
| Route | Entra groups on the host | Use it when |
|---|---|---|
Azure Entra SSH sign-in (aad module) | None: each account has only its private group | Azure VMs, with users assignments |
| Himmelblau | The user's Entra groups, named in id and initgroups | Group profiles without a managed domain |
| Entra Domain Services with SSSD | The synced Entra groups, as Active Directory groups | You already run, or want, a managed AD domain |
Before you start, prepare the groups and users as in Prepare the tenant and get the starter kit.
Azure VMs with Entra SSH sign-in
Enable the sign-in on the VM
The script enables the VM's system-assigned identity, installs the AADSSHLoginForLinux extension and grants the Virtual Machine User Login role. --admin grants Virtual Machine Administrator Login instead, which carries sudo rights. It prints a plan until you add --apply:
./setup-entra-ssh-linux.sh -g my-rg -n my-vm --user alice@contoso.onmicrosoft.com --group defenseclaw-ml-team
./setup-entra-ssh-linux.sh -g my-rg -n my-vm --user alice@contoso.onmicrosoft.com --group defenseclaw-ml-team --applySign in
az extension add --name ssh
az ssh vm -g my-rg -n my-vmThe aad module adds itself to passwd and group in /etc/nsswitch.conf and names the account by its UPN. It gives the account only its private group:
$ id
uid=9246366(alice@contoso.onmicrosoft.com) gid=9246366(alice@contoso.onmicrosoft.com) groups=9246366(alice@contoso.onmicrosoft.com)
$ getent group defenseclaw-ml-team
$Install DefenseClaw and assign profiles
Install DefenseClaw per user as that user (Quickstart). Assign profiles by users, or add a local group of your own. The Entra role is only for sign-in; DefenseClaw does not use it. The standalone enterprise package on an Entra Linux VM is Preview.
Himmelblau
Himmelblau is an open-source (GPL-3.0) NSS, PAM and SSH module that signs Entra users in to Linux and reads their Entra groups. It needs no app registration. These steps use the 5.0.0 nightly build on Ubuntu 24.04, its free channel; the 4.x stable packages need a paid entitlement token.
Register MFA for each user
Entra refuses remote sign-in through Himmelblau for a user with no MFA method (AADSTS50072, "Remote session with unenrolled MFA user denied"). Have each user register an authenticator app at Security info.
The first sign-in asks for the Entra password, the code and a new Windows Hello PIN of at least six characters. It joins the computer to Entra and creates a device object, so your users need permission to join devices.
Install and configure
Run as root; the script prints its plan first:
GROUP_OBJECT_ID=00000000-0000-0000-0000-000000000000 # the Entra group object id
sudo ./setup-himmelblau.sh install --domain contoso.onmicrosoft.com --allow-group "$GROUP_OBJECT_ID"
sudo ./setup-himmelblau.sh install --domain contoso.onmicrosoft.com --allow-group "$GROUP_OBJECT_ID" --apply
./setup-himmelblau.sh check --user alice@contoso.onmicrosoft.comThe packages add himmelblau to the passwd, group and shadow lines of nsswitch.conf and to PAM, but write no /etc/himmelblau/himmelblau.conf, and the daemon does not start without its domain. The script writes these keys:
| Key | Why |
|---|---|
domain = contoso.onmicrosoft.com | The tenant |
cn_name_mapping = false | Names accounts by their UPN. With the default (true) accounts are named alice and carry no UPN or domain, so a users entry written as a UPN never matches. Groups match either way |
pam_allow_groups = <object id>,... | Only members of these Entra groups may sign in. Without it every user of the tenant can. It takes object IDs, not names |
home_attr, home_alias = CN, use_etc_skel = true | Home directories named by the account |
configure --apply rewrites these keys and removes any other himmelblau.conf settings. Its preview names the unmanaged keys, and each apply keeps a timestamped backup. An omitted --allow-group keeps an existing pam_allow_groups; --allow-all removes it.
Assign profiles by group name
id names the Entra groups, but getent group ml-team answers nothing: Himmelblau finds a group only by gid or object ID. DefenseClaw matches the names id reports, without regard to case (Unicode case folding). Spaces and accents are part of the name; quote a name with spaces in YAML, for example groups: ["Research ML Team"].
The records carry directory entra_id, source himmelblau, assurance verified, a posix_uid, the private group plus the Entra groups in group_count, and the SSH session.
How Himmelblau behaves in operation:
| Situation | What happens |
|---|---|
| Group change | Himmelblau caches an account for 300 seconds (cache_timeout). A new sign-in, or sudo aad-tool cache-clear, shows it at once. DefenseClaw then picks it up within its 15-minute cache |
| Entra unreachable | Cached accounts and groups keep answering, also across a daemon restart. A new SSH sign-in of an MFA user is refused (PAM_ABORT: Network outage detected) unless Himmelblau's offline_breakglass is set up (off by default; Preview) |
| Daemon down or restarting | id shows the Entra groups as bare numbers. DefenseClaw keeps such an answer for 2 minutes instead of 15, so a member gets the group profile again within about 2 minutes of the daemon's return |
| Restart | Use setup-himmelblau.sh restart --apply; configure restarts the same way. It stops the sockets and daemons, clears the stored descriptors and starts them again, which avoids units stuck in inactive (dead-resources-pinned) |
Microsoft Entra Domain Services with SSSD
Microsoft Entra Domain Services runs a managed Active Directory domain that syncs the tenant's users and groups. A Linux host joins it with realm join like any AD domain, SSSD reads the Entra groups as AD groups, and DefenseClaw reports the account as active_directory. Microsoft bills the managed domain while it exists.
Create the managed domain
Once per tenant, in the Azure portal or with ARM:
- Register the
Microsoft.AADresource provider. Create the Domain Controller Services service principal, the AAD DC Administrators group and an admin user in it. - Create a VNet with a subnet for the domain and one for the VMs.
- Create the managed domain with TLS 1.0 disabled (
domainSecuritySettings.tlsV1: Disabled). Creation can take more than an hour. - Point the VNet's DNS servers at both domain controllers.
- Have each user change their password, or reset it, once the domain exists, so it gets the NTLM and Kerberos hashes. This can take several minutes to sync. Repeated failed
kinitattempts lock the account for 30 minutes.
Join the host
Run as root; the script prints its plan first:
sudo ./join-entra-domain-services.sh join --domain contoso.onmicrosoft.com --admin dsadmin@contoso.onmicrosoft.com --short-names
sudo ./join-entra-domain-services.sh join --domain contoso.onmicrosoft.com --admin dsadmin@contoso.onmicrosoft.com --short-names --apply
./join-entra-domain-services.sh check --user alice --group ml-teamIt installs realmd, SSSD and adcli, and runs realm join --membership-software=adcli -U dsadmin@CONTOSO.ONMICROSOFT.COM contoso.onmicrosoft.com, which asks for the password. The computer account lands in OU=AADDC Computers, and SSSD gets id_provider = ad.
Choose qualified or short names
realm join sets use_fully_qualified_names = True, so the host knows the group only as ml-team@contoso.onmicrosoft.com and the user as alice@contoso.onmicrosoft.com. A groups: [ml-team] assignment then selects nobody, and explain names the qualified group the host knows.
Either write the qualified name in the assignment, or switch to short names (--short-names, or join-entra-domain-services.sh names short --apply).
What DefenseClaw records: directory active_directory, source sssd, the domain, the bare account name and the uid from SSSD's ID mapping.
- On standalone enterprise the root guardian reads the UPN from InfoPipe after the reconcile that enrolls the account, and the source becomes
sssd_infopipe. Until then the principal isalice@CONTOSO.ONMICROSOFT.COM; the UPN replaces it within about 2 minutes. - A per-user install has no InfoPipe access and keeps the realm-derived principal.
Group changes pass through three caches:
| Cache | Delay | Shorten it with |
|---|---|---|
| Entra to the managed domain | Usually under a minute | Nothing |
| SSSD entry cache | entry_cache_timeout, 5,400 seconds by default | sudo sss_cache -E (join-entra-domain-services.sh flush --apply) |
| DefenseClaw directory facts | Up to 15 minutes | Refresh every account now |
End to end, expect about 15 minutes with a flush and up to about 105 minutes with SSSD's defaults.
Troubleshooting
Identity problems and their fixes are in Troubleshooting: Entra ID on Linux.
Entra ID on macOS
Use Microsoft Entra ID users with DefenseClaw on a Mac with Platform SSO, and carry Entra group membership in a local group with a bridge script.
Trusted connectors
Let a gateway that runs agents for many people name the person it acts for, so each gets their own guardrail profile. Managed devices only; off by default.