EnterpriseIdentity

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

SetupUsers sign in withDefenseClaw seesA groups assignment can nameGuide
Entra-joined Windows 10 or 11Entra ID at the Windows sign-in screenDirectory entra_id, the user SID, the UPN and the tenant IDEnterprise: an Entra group by SID, once a built-in local group lists it. Per-user: no groups, use usersWindows
Azure Linux VM with Entra SSH sign-inaz ssh vm, with the aad moduleDirectory entra_id, source nss_aad, the UPNNo Entra group: the module gives only a private groupLinux
Linux with Himmelblaussh with the Entra password, an MFA code and a Hello PINDirectory entra_id, source himmelblau; the UPN when accounts are named by itThe user's Entra groups, by nameLinux
Linux joined to Microsoft Entra Domain Servicesssh with the Entra password, through SSSDDirectory active_directory and the domain. Per-user: source sssd; enterprise: sssd_infopipe with the UPNThe synced Entra groups, as name@domain unless SSSD uses short namesLinux
Mac with Platform SSO (Company Portal)Entra ID at the macOS login windowEnterprise: directory entra_id, source macos_platform_sso, the UPN. Per-user: directory localNo Entra group; only a local group that carries the membershipmacOS
Linux desktop enrolled in IntuneA local account; Intune does not sign users inDirectory localLocal groupsNone 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.

FileUse
entra_setup.pyMicrosoft 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.shEnable Entra SSH sign-in on an Azure Linux VM and grant the sign-in role
Add-EntraGroupToLocalGroup.ps1Put an Entra group's SID into a built-in local group, so the group appears in sign-in tokens
Get-DefenseClawEntraIdentity.ps1Read-only: the join state, the Entra accounts, the token's groups and what DefenseClaw answers
setup-himmelblau.shInstall Himmelblau on Ubuntu 24.04, write himmelblau.conf and restart it safely; check is read-only
join-entra-domain-services.shJoin 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.shAdd a Mac user to, or remove them from, the local group that stands for an Entra group
macos-platform-sso.settings-catalog.example.jsonThe Intune settings catalog body for Platform SSO with Company Portal
admin-config.windows.example.yaml, per-user-profiles.example.yaml, tenant.example.jsonStarting 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:

CommandApplication permissions
applyGroup.ReadWrite.All, User.ReadWrite.All, Organization.Read.All
check (read-only)Organization.Read.All, Policy.Read.All
sidsGroup.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-team
group defenseclaw-ml-team
      object id  6f1c9a0e-3b2d-4c58-9e71-a4b5c6d7e8f9
      SID        S-1-12-1-1864145422-1280850733-3047453086-4192786374

Windows 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 default

A 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.

Whereusers by UPNgroups by Entra group
Windows, per-userYesNo: a per-user install has no group list
Windows, standalone enterpriseYes, until the account's UPN is renamed (the SID stays)By SID, after the local group step
Linux aad, per-userYes. Check that NSS resolves the account by uid as well as by nameNo: the module gives no Entra groups
Linux Himmelblau, per-user and standaloneWith cn_name_mapping = falseBy name, as id shows it
Linux Entra Domain Services, per-user and standaloneOn standalone enterprise, once InfoPipe supplies the UPNml-team@domain, or ml-team with short names
macOS Platform SSO, standaloneYesOnly a local group that carries the membership
macOS Platform SSO, per-userNo: the account reports local without a UPNOnly 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 claudecode
defenseclaw 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 claudecode

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

AttributeEntra-joined WindowsLinux with the aad module
user.id, defenseclaw.user.id_kindThe S-1-12-1-... SID, windows_sidThe uid the module assigns, posix_uid
defenseclaw.user.nameThe account name Windows assigns (EntraAlice for AzureAD\EntraAlice), not the UPNalice, the account part of the UPN
defenseclaw.user.principalThe UPNThe UPN, in lower case
defenseclaw.user.domaincontoso.onmicrosoft.comcontoso.onmicrosoft.com
defenseclaw.user.directory, .identity.sourceentra_id, windows_identity_storeentra_id, nss_aad
defenseclaw.user.tenant_idThe tenant IDNot reported
defenseclaw.user.principal.assuranceverifiedverified
defenseclaw.user.group_count0: a per-user install has no group list1: the private group
defenseclaw.session.kindNot reported: a remote desktop session is only claimedssh 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 explain then reports unixidentity: 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