EnterpriseIdentity

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.

RouteEntra groups on the hostUse it when
Azure Entra SSH sign-in (aad module)None: each account has only its private groupAzure VMs, with users assignments
HimmelblauThe user's Entra groups, named in id and initgroupsGroup profiles without a managed domain
Entra Domain Services with SSSDThe synced Entra groups, as Active Directory groupsYou 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 --apply

Sign in

az extension add --name ssh
az ssh vm -g my-rg -n my-vm

The 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.com

The 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:

KeyWhy
domain = contoso.onmicrosoft.comThe tenant
cn_name_mapping = falseNames 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 = trueHome 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:

SituationWhat happens
Group changeHimmelblau 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 unreachableCached 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 restartingid 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
RestartUse 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:

  1. Register the Microsoft.AAD resource provider. Create the Domain Controller Services service principal, the AAD DC Administrators group and an admin user in it.
  2. Create a VNet with a subnet for the domain and one for the VMs.
  3. Create the managed domain with TLS 1.0 disabled (domainSecuritySettings.tlsV1: Disabled). Creation can take more than an hour.
  4. Point the VNet's DNS servers at both domain controllers.
  5. 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 kinit attempts 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-team

It 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 is alice@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:

CacheDelayShorten it with
Entra to the managed domainUsually under a minuteNothing
SSSD entry cacheentry_cache_timeout, 5,400 seconds by defaultsudo sss_cache -E (join-entra-domain-services.sh flush --apply)
DefenseClaw directory factsUp to 15 minutesRefresh 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.