Microsoft Entra ID
Microsoft Entra ID — users, groups, applications, service principals, directory roles, administrative units, devices, Conditional Access policies, sign-in / audit logs, and round-trip state for the most-edited resources.
weave entra
Env: AZURE_TENANT_ID
Setup
Configure credentials via environment variables. We recommend sourcing them through 1Password or your secrets manager rather than committing them to the shell rc.
Official API reference
weave commands for this module are checked against the vendor's published API.
| Variable | Description | Status |
|---|---|---|
| AZURE_TENANT_ID | Required for authentication. | required |
| AZURE_CLIENT_ID | Required for authentication. | required |
| AZURE_CLIENT_SECRET | Required for authentication. | required |
| AZURE_AD_ENDPOINT | Sovereign-cloud login endpoint (defaults to https://login.microsoftonline.com) | optional |
| GRAPH_BASE_URL | Sovereign-cloud Graph base URL (defaults to https://graph.microsoft.com) | optional |
Sanity-check the wiring:
weave secrets check weave entra --help weave doctor # reports AZURE_TENANT_ID status
Capabilities
What this module can do, by entity and verb. ✓
means a working CLI surface; · means
not (yet) wired.
| Entity | find | list | show | do | snapshot | diff | apply |
|---|---|---|---|---|---|---|---|
| administrative-unit | · | ✓ | · | ✓ | ✓ | ✓ | ✓ |
| app | ✓ | ✓ | · | ✓ | ✓ | ✓ | · |
| au-members | · | · | ✓ | · | · | · | · |
| audit-log | · | ✓ | · | · | · | · | · |
| conditional-access-policies | · | · | · | · | ✓ | ✓ | · |
| conditional-access-policy | · | ✓ | · | · | · | · | · |
| device | · | ✓ | ✓ | ✓ | ✓ | ✓ | · |
| directory-role | · | ✓ | · | · | · | · | · |
| group | ✓ | ✓ | · | ✓ | ✓ | ✓ | ✓ |
| group-members | · | · | ✓ | · | · | · | · |
| group-memberships | · | · | · | · | ✓ | ✓ | ✓ |
| group-owners | · | · | ✓ | · | · | · | · |
| named-location | · | ✓ | · | · | ✓ | ✓ | · |
| role | · | · | · | ✓ | · | · | · |
| role-assignment | · | ✓ | · | · | ✓ | ✓ | ✓ |
| service-principal | ✓ | ✓ | · | · | ✓ | ✓ | · |
| signin-log | · | ✓ | · | · | · | · | · |
| user | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | · |
| user-licenses | · | · | ✓ | · | · | · | · |
| user-manager | · | · | ✓ | · | · | · | · |
| user-mfa | · | · | ✓ | · | · | · | · |
Commands
Every registered CLI command, grouped by verb. Each example uses placeholder arguments — substitute real values for your environment.
find (4)
find app
readFind an application by displayName, appId, or object id.
weave entra find app <identifier>
find group
readFind a group by displayName or object id.
weave entra find group <identifier>
find service-principal
readFind a service principal by displayName, appId, or id.
weave entra find service-principal <identifier>
find user
readFind a user by UPN, email, or object id.
weave entra find user <identifier>
list (12)
list administrative-units
readList administrative units (OU-equivalent).
weave entra list administrative-units <arg>
list apps
readList application registrations.
weave entra list apps <arg>
list audit-logs
readDirectory audit log (admin actions, lifecycle events).
weave entra list audit-logs <arg>
list conditional-access-policies
readList Conditional Access policies.
weave entra list conditional-access-policies <arg>
list devices
readList devices registered in the tenant.
weave entra list devices <arg>
list directory-roles
readList active directory roles in the tenant.
weave entra list directory-roles <arg>
list groups
readList directory groups.
weave entra list groups <arg>
list named-locations
readList Conditional Access named locations.
weave entra list named-locations <arg>
list role-assignments
readList directory role assignments (unified RBAC).
weave entra list role-assignments <arg>
list service-principals
readList service principals (enterprise apps).
weave entra list service-principals <arg>
list signin-logs
readSign-in events (last 24h by default).
weave entra list signin-logs <arg>
list users
readList directory users.
weave entra list users <arg>
show (9)
show app-role-assignments
readApplication permissions (appRoles) granted to an app's service principal.
weave entra show app-role-assignments <app>
show au-members
readMembers of an administrative unit.
weave entra show au-members <identifier>
show device
readFull record for one device.
weave entra show device <identifier>
show group-members
readDirect members of a group.
weave entra show group-members <identifier>
show group-owners
readOwners of a group.
weave entra show group-owners <identifier>
show user
readFull record for one user.
weave entra show user <identifier>
show user-licenses
readLicense plans assigned to a user.
weave entra show user-licenses <identifier>
show user-manager
readManager (reporting line) for a user.
weave entra show user-manager <identifier>
show user-mfa
readAuthentication / MFA methods registered for a user.
weave entra show user-mfa <identifier>
do (20)
do add-au-member
writeAdd a user/group to an administrative unit.
weave entra do add-au-member <object-id>
do add-member
writeAdd a user to a group.
weave entra do add-member <user>
do add-owner
writeAdd a user as a group owner.
weave entra do add-owner <user>
do assign-role
writeAssign a directory role to a principal.
weave entra do assign-role <principal>
do create-app-password
writeMint a client secret for an application registration.
weave entra do create-app-password <app-id>
do delete-app-password
writeRevoke an application client secret by keyId.
weave entra do delete-app-password <app-id>
do delete-device
writePermanently delete a device record.
weave entra do delete-device <identifier>
do disable
writeDisable a user (accountEnabled=false).
weave entra do disable <identifier>
do disable-device
writeDisable a device (accountEnabled=false).
weave entra do disable-device <identifier>
do enable
writeRe-enable a previously disabled user.
weave entra do enable <identifier>
do enable-device
writeRe-enable a previously disabled device.
weave entra do enable-device <identifier>
do grant-app-role
writeGrant an application permission (appRole) to an app's service principal — the admin-consent equivalent.
weave entra do grant-app-role <app> <permission>
do remove-au-member
writeRemove a user/group from an administrative unit.
weave entra do remove-au-member <object-id>
do remove-member
writeRemove a user from a group.
weave entra do remove-member <user>
do remove-owner
writeRemove a group owner.
weave entra do remove-owner <user>
do reset-password
writeReset a user's password (returns a new temporary password).
weave entra do reset-password <identifier>
do restore
writeRestore a soft-deleted user (within 30-day window).
weave entra do restore <identifier>
do revoke-app-role
writeRevoke an application permission (appRoleAssignment) by id.
weave entra do revoke-app-role <app>
do revoke-sessions
writeForce sign-out of all sessions for a user.
weave entra do revoke-sessions <identifier>
do unassign-role
writeRemove a directory role assignment by id.
weave entra do unassign-role <assignment-id>
snapshot → edit YAML →
diff → apply --yes (or confirm
interactively; apply --dry-run previews the same diff).
State kinds
Resources this module can snapshot and
diff; apply where the kind supports
live writes (see Round-trip per kind). Always run
diff before apply; use
--yes in automation after review. Files live under
.weave-state/entra/.
users
Directory users — UPN, profile fields, accountEnabled (snapshot+diff only).
State file skeleton
module: entra kind: users items: - # <fields specific to this kind — see snapshot output>
groups
All Entra directory groups with their member UPNs (full apply; dynamic / on-prem groups noop).
State file skeleton
module: entra kind: groups items: - # <fields specific to this kind — see snapshot output>
group-memberships
Direct members of one specified group (full apply, scoped via --group).
State file skeleton
module: entra kind: group-memberships group: <value> items: - # <fields specific to this kind — see snapshot output>
apps
Application registrations — metadata only, no secrets (snapshot+diff only).
State file skeleton
module: entra kind: apps items: - # <fields specific to this kind — see snapshot output>
service-principals
Service principals (enterprise-app projection) — metadata only (snapshot+diff only).
State file skeleton
module: entra kind: service-principals items: - # <fields specific to this kind — see snapshot output>
role-assignments
Directory-role assignments (principal × role × scope) — full apply.
State file skeleton
module: entra kind: role-assignments items: - # <fields specific to this kind — see snapshot output>
administrative-units
Administrative-unit containers (display fields; members tracked via do verbs).
State file skeleton
module: entra kind: administrative-units items: - # <fields specific to this kind — see snapshot output>
devices
Registered device inventory (snapshot+diff only; lifecycle via do verbs).
State file skeleton
module: entra kind: devices items: - # <fields specific to this kind — see snapshot output>
conditional-access-policies
Conditional Access policies (snapshot+diff only — write API is per-type).
State file skeleton
module: entra kind: conditional-access-policies items: - # <fields specific to this kind — see snapshot output>
named-locations
Conditional Access named locations (IP / country) — snapshot+diff only.
State file skeleton
module: entra kind: named-locations items: - # <fields specific to this kind — see snapshot output>
Workflows
End-to-end recipes from operators who already run this module in production. Copy, adapt, and put under change-control.
Onboard a new hire
Find the user, drop them in groups, assign manager, sanity-check their MFA inventory.
weave entra find user new.hire@example.com weave entra do add-member new.hire@example.com --group 'All Engineering' --yes weave entra do add-member new.hire@example.com --group 'VPN-Users' --yes weave entra show user-manager new.hire@example.com weave entra show user-mfa new.hire@example.com # confirm registration
Quarantine a compromised account
Disable, revoke every session, watch the sign-in log for blocked retries.
weave entra find user alice@example.com weave entra do disable alice@example.com --yes weave entra do revoke-sessions alice@example.com --yes weave entra list signin-logs --user alice@example.com --since 1h
Quarterly access review
Snapshot groups + role assignments, commit, diff next quarter to spot drift.
weave entra snapshot groups weave entra snapshot role-assignments weave entra snapshot administrative-units git add .weave-state/entra && git commit -m 'entra access review Q1' # … next quarter … weave entra diff groups weave entra diff role-assignments
Rotate a service-account client secret
Mint a new password for the Entra app reg, capture it once, revoke the old keyId.
weave entra find app 11111111-2222-3333-4444-555555555555 weave entra do create-app-password 11111111-2222-3333-4444-555555555555 --months 6 --show-secret --yes # update the consuming service with the new secret … weave entra do delete-app-password 11111111-2222-3333-4444-555555555555 --key-id <old-keyId> --yes
Terraform parity
For each Terraform resource in the canonical provider, here's the equivalent live-API verb in weave. Use this as a migration cheat-sheet, not a 1:1 contract — weave deliberately stays in the live-state lane, not the desired-state lane.
| Terraform resource | weave equivalent |
|---|---|
| azuread_user | weave entra find/list/show user / snapshot users + do disable / enable / revoke-sessions / reset-password / restore |
| azuread_user_password_lifecycle | weave entra do reset-password (--show-secret to display the temp password) |
| azuread_group | weave entra find/list/show group / snapshot groups (full apply) |
| azuread_group_member | weave entra do add-member / remove-member / show group-members + snapshot group-memberships --group=<id|name> |
| azuread_group_owner | weave entra do add-owner / remove-owner / show group-owners |
| azuread_application | weave entra find/list app / snapshot apps (snapshot+diff only — secrets / certs / redirect URIs aren't safe to round-trip) |
| azuread_application_password | weave entra do create-app-password / delete-app-password (--show-secret to display the value once) |
| azuread_application_certificate | Not exposed — certificates need an X.509 upload flow Use Terraform's azuread_application_certificate or the portal. |
| azuread_application_pre_authorized | Embedded in the app registration body; managed via Terraform Snapshot captures it as part of the apps record. |
| azuread_service_principal | weave entra find/list service-principal / snapshot service-principals (snapshot+diff only) |
| azuread_service_principal_password | Same shape as application password — use create-app-password against the SP's appId |
| azuread_directory_role | weave entra list directory-roles |
| azuread_directory_role_assignment | weave entra list role-assignments / do assign-role / unassign-role / snapshot role-assignments (full apply) |
| azuread_administrative_unit | weave entra list administrative-units / snapshot administrative-units (full apply) |
| azuread_administrative_unit_member | weave entra show au-members / do add-au-member / remove-au-member |
| azuread_administrative_unit_role_member | Tracked through role-assignments scoped to the AU id (use --scope=<au-id> on do assign-role) |
| azuread_named_location / azuread_named_location_country / azuread_named_location_ip | weave entra list named-locations / snapshot named-locations (snapshot+diff only — bodies are per-type) |
| azuread_conditional_access_policy | weave entra list conditional-access-policies / snapshot conditional-access-policies (snapshot+diff only — write API is gnarly) |
| azuread_device | weave entra list devices / show device / snapshot devices + do disable-device / enable-device / delete-device |
| (sign-in / audit log tail) | weave entra list signin-logs --since=24h --user=<upn> / list audit-logs --since=24h --activity=<name> Operational verbs unique to weave — no Terraform equivalent. |
| azuread_synchronization_job / azuread_synchronization_secret | Not exposed — cross-tenant / B2B sync needs Premium licensing and a separate provisioning flow Future work — Premium P2 only, low operator demand. |
| azuread_invitation | Not exposed — B2B invitation requires interactive redemption flow Future work — flow-driven, not state-friendly. |
| azuread_user_flow_attribute | Not exposed — Azure AD B2C-specific resource Out of scope — B2C is a separate product surface. |
| azuread_access_package / azuread_access_package_assignment_policy / azuread_access_package_catalog_* | Not exposed — Identity Governance is Premium P2 with low operator-CLI traffic Future work — covered by Microsoft Entra portal until demand surfaces. |
Troubleshooting & source
Run weave doctor — it reports which env
vars (including AZURE_TENANT_ID) are set
and which are blank.
Re-run weave entra diff <kind>
to confirm the controller's current state, then re-snapshot
before the next apply. The driver always re-snapshots
before diffing.
The module lives at https://github.com/andy-broyles/weavewhatever/tree/main/src/weave/modules/entra. File a bug or feature request at https://github.com/andy-broyles/weavewhatever/issues.