Deploy with Microsoft Entra ID
Deploy DefenseClaw with Microsoft Entra ID on Windows, Linux and macOS: pick a setup, prepare the tenant, map groups to guardrail profiles, check records.
DefenseClaw never calls Microsoft Entra ID or Microsoft Graph. A user signs in to the computer with Entra ID, the computer gives that user an operating system account, and DefenseClaw reads that account like any other. A groups assignment can name an Entra group only where the operating system knows the membership.
Guardrail profiles apply to per-user installs and to the standalone enterprise profile. What is read from where is in How DefenseClaw knows who a user is.
Preview
Entra ID support is Preview in every setup on these pages: it is available but may change. Active Directory is the supported identity stack.
Pick your setup
| Setup | Users sign in with | DefenseClaw sees | A groups assignment can name | Guide |
|---|---|---|---|---|
| Entra-joined Windows 10 or 11 | Entra ID at the Windows sign-in screen | Directory entra_id, the user SID, the UPN and the tenant ID | Enterprise: an Entra group by SID, once a built-in local group lists it. Per-user: no groups, use users | Windows |
| Azure Linux VM with Entra SSH sign-in | az ssh vm, with the aad module | Directory entra_id, source nss_aad, the UPN | No Entra group: the module gives only a private group | Linux |
| Linux with Himmelblau | ssh with the Entra password, an MFA code and a Hello PIN | Directory entra_id, source himmelblau; the UPN when accounts are named by it | The user's Entra groups, by name | Linux |
| Linux joined to Microsoft Entra Domain Services | ssh with the Entra password, through SSSD | Directory active_directory and the domain. Per-user: source sssd; enterprise: sssd_infopipe with the UPN | The synced Entra groups, as name@domain unless SSSD uses short names | Linux |
| Mac with Platform SSO (Company Portal) | Entra ID at the macOS login window | Enterprise: directory entra_id, source macos_platform_sso, the UPN. Per-user: directory local | No Entra group; only a local group that carries the membership | macOS |
| Linux desktop enrolled in Intune | A local account; Intune does not sign users in | Directory local | Local groups | None needed |
If a groups assignment matches no one, the operating system usually does not know the Entra group. Check as the user with whoami /groups on Windows or id on Linux and macOS. If the group is not listed there, no DefenseClaw setting can match it.
Starter kit
The scripts and example configs are in packaging/identity/entra. Every script has --help (or Get-Help), reads credentials from the environment, never from arguments, and changes nothing until you say so. The Python and shell scripts print a plan unless you pass --apply; the PowerShell scripts support -WhatIf.
| File | Use |
|---|---|
entra_setup.py | Microsoft Graph helper: create groups and users from a JSON file, read the Windows SID of a group or user, compute a SID from an object ID offline |
setup-entra-ssh-linux.sh | Enable Entra SSH sign-in on an Azure Linux VM and grant the sign-in role |
Add-EntraGroupToLocalGroup.ps1 | Put an Entra group's SID into a built-in local group, so the group appears in sign-in tokens |
Get-DefenseClawEntraIdentity.ps1 | Read-only: the join state, the Entra accounts, the token's groups and what DefenseClaw answers |
setup-himmelblau.sh | Install Himmelblau on Ubuntu 24.04, write himmelblau.conf and restart it safely; check is read-only |
join-entra-domain-services.sh | Join a Linux host to an Entra Domain Services managed domain, switch between qualified and short names, clear the SSSD cache; check is read-only |
macos-entra-group-bridge.sh | Add a Mac user to, or remove them from, the local group that stands for an Entra group |
macos-platform-sso.settings-catalog.example.json | The Intune settings catalog body for Platform SSO with Company Portal |
admin-config.windows.example.yaml, per-user-profiles.example.yaml, tenant.example.json | Starting points for the standalone config, a per-user config and the tenant setup file |
Prepare the tenant
DefenseClaw needs nothing special from the tenant: no paid licence and no app registration of its own. You need the groups and users your profiles will name, and the SID of each group. The entra_setup.py helper creates them.
Register the helper
Create an app registration for entra_setup.py and grant admin consent:
| Command | Application permissions |
|---|---|
apply | Group.ReadWrite.All, User.ReadWrite.All, Organization.Read.All |
check (read-only) | Organization.Read.All, Policy.Read.All |
sids | Group.Read.All, User.Read.All |
A token in GRAPH_ACCESS_TOKEN works instead of the app registration.
Create the groups and users
Give the script its credentials through the environment:
export AZURE_TENANT_ID=00000000-0000-0000-0000-000000000000
export AZURE_CLIENT_ID=00000000-0000-0000-0000-000000000000
read -rs AZURE_CLIENT_SECRET && export AZURE_CLIENT_SECRET # type it; it stays out of your history
python3 entra_setup.py check # tenant, domains, security defaults
cp tenant.example.json tenant.json # edit the domain, groups and users
python3 entra_setup.py apply --config tenant.json # a preview; changes nothing
python3 entra_setup.py apply --config tenant.json --apply --password-file users.txt- The script creates missing objects, leaves existing users unchanged and adds the requested group memberships, so it is safe to run again.
- New users get a generated password that goes only to the
--password-file(mode 0600). - A Microsoft Graph read failure stops the plan, including a preview.
- Group references match planned groups without regard to case.
- It refuses existing dynamic or mail-enabled groups; use a static security group.
Read each group's SID
python3 entra_setup.py sids --group defenseclaw-ml-teamgroup defenseclaw-ml-team
object id 6f1c9a0e-3b2d-4c58-9e71-a4b5c6d7e8f9
SID S-1-12-1-1864145422-1280850733-3047453086-4192786374Windows shows an Entra group only by this SID. The SID is four 32-bit words of the object ID, so entra_setup.py sid-from-object-id 6f1c9a0e-... computes it without a tenant.
Then follow the guide for your platform: Windows, Linux or macOS.
Map users and groups to profiles
Write users assignments with the principal the host actually resolves; a UPN compares without regard to case. Use the SID for Entra groups on Windows. Starter files: per-user-profiles.example.yaml and admin-config.windows.example.yaml. The keys are in User- and group-based policies.
guardrail:
profiles:
strict: {mode: action, block_at: MEDIUM}
ml-team: {mode: observe}
profile_assignments:
- profile: ml-team
match:
users: ["alice@contoso.onmicrosoft.com"]
- profile: ml-team # standalone enterprise on Windows only
match:
groups: ["S-1-12-1-1864145422-1280850733-3047453086-4192786374"]
default_profile: strict
ai_discovery:
include_user_principal: true # put the UPN in records; off by defaultA per-user config belongs to the user
A per-user install reads ~/.defenseclaw/config.yaml (Windows: %USERPROFILE%\.defenseclaw\config.yaml) from the user's own profile, so the user can change their profile. To enforce a policy the user cannot change, use the standalone enterprise profile, which reads the machine config.
| Where | users by UPN | groups by Entra group |
|---|---|---|
| Windows, per-user | Yes | No: a per-user install has no group list |
| Windows, standalone enterprise | Yes, until the account's UPN is renamed (the SID stays) | By SID, after the local group step |
Linux aad, per-user | Yes. Check that NSS resolves the account by uid as well as by name | No: the module gives no Entra groups |
| Linux Himmelblau, per-user and standalone | With cn_name_mapping = false | By name, as id shows it |
| Linux Entra Domain Services, per-user and standalone | On standalone enterprise, once InfoPipe supplies the UPN | ml-team@domain, or ml-team with short names |
| macOS Platform SSO, standalone | Yes | Only a local group that carries the membership |
| macOS Platform SSO, per-user | No: the account reports local without a UPN | Only a local group |
Set a strict default_profile for accounts no assignment selects. A failed lookup refuses requests whose assignments need the missing fact, and the refusal names it (why).
Check
Ask the gateway which profile a user gets. On Windows, name an Entra user by SID, as AzureAD\Name, by the bare name or by the UPN.
# Standalone enterprise: run in an elevated Administrator prompt.
& 'C:\Program Files\Cisco\DefenseClaw\bin\defenseclaw.exe' enterprise windows profile-explain --user 'AzureAD\Alice' --connector claudecode
# Per-user install:
defenseclaw guardrail profile explain --connector claudecodedefenseclaw guardrail profile explain --connector claudecode
# standalone enterprise, as root:
sudo /opt/defenseclaw/bin/defenseclaw-gateway enterprise linux profile-explain --user alice --connector claudecode
sudo /opt/cisco/defenseclaw/bin/defenseclaw-gateway enterprise macos profile-explain --user alice --connector claudecodeprofile names the profile and match says user or group; another Entra user gets default_profile. The records of an Entra user such as alice@contoso.onmicrosoft.com on a per-user install carry:
| Attribute | Entra-joined Windows | Linux with the aad module |
|---|---|---|
user.id, defenseclaw.user.id_kind | The S-1-12-1-... SID, windows_sid | The uid the module assigns, posix_uid |
defenseclaw.user.name | The account name Windows assigns (EntraAlice for AzureAD\EntraAlice), not the UPN | alice, the account part of the UPN |
defenseclaw.user.principal | The UPN | The UPN, in lower case |
defenseclaw.user.domain | contoso.onmicrosoft.com | contoso.onmicrosoft.com |
defenseclaw.user.directory, .identity.source | entra_id, windows_identity_store | entra_id, nss_aad |
defenseclaw.user.tenant_id | The tenant ID | Not reported |
defenseclaw.user.principal.assurance | verified | verified |
defenseclaw.user.group_count | 0: a per-user install has no group list | 1: the private group |
defenseclaw.session.kind | Not reported: a remote desktop session is only claimed | ssh with client.address, confirmed through logind |
Records have no principal while ai_discovery.include_user_principal is off, the default.
What to expect in operation
- Group changes reach DefenseClaw at different speeds per platform: at the next sign-in on Windows, after the Himmelblau or SSSD cache plus DefenseClaw's 15 minutes on Linux, and when the bridge script runs again on macOS. Each platform guide has the details.
- A user who has not signed in yet. On Windows, the host may resolve an Entra name or UPN to a SID before first sign-in, but it has no sign-in token for group membership. On Azure Linux, NSS may resolve a name before it can map a uid back to the account;
profile explainthen reportsunixidentity: not found. - An Entra outage or no network. On Windows, open sessions keep the same hook decisions, also across a gateway restart, because DefenseClaw reads the identity store, join state and token locally. Windows refuses a new password sign-in while Entra is unreachable. On Linux, a failed lookup refuses an assignment that needs the missing fact (
default_lookup_failed) once the gateway's cached answer expires (up to an hour); see the lookup rules.
Next steps
Okta on Linux
Read Okta users and groups on Linux through the Okta LDAP Interface and SSSD, choose guardrail profiles by Okta group and troubleshoot the setup.
Entra ID on Windows
Use Microsoft Entra ID users and groups with DefenseClaw on Entra-joined Windows: join the computer, map a group to the sign-in token and fix problems.