s365b.modules.entra¶
Entra ID module: directory objects, roles and policies.
Every run reads a full snapshot (directory data is small). Each object is stored as normalised JSON, so an unchanged object is deduplicated and costs nothing; changed objects get a new version, and objects that disappeared are recorded as deleted.
Restore is not implemented yet; the restore app gets no Entra permissions until it is.
Submodules¶
Classes¶
Backs up Entra ID (Azure AD) directory objects and policies. |
Package Contents¶
- class s365b.modules.entra.EntraModule[source]¶
Bases:
s365b.modules.sdk.BackupModuleBacks up Entra ID (Azure AD) directory objects and policies.
- id: ClassVar[str] = 'entra'¶
- display_name: ClassVar[str] = 'Entra ID'¶
- description: ClassVar[str] = 'Users, groups, apps, roles, Conditional Access and tenant policies.'¶
- version: ClassVar[str] = '0.2.0'¶
- object_noun: ClassVar[tuple[str, str]] = ('category', 'categories')¶
- required_permissions(config: pydantic.BaseModel, *, restore: bool) set[str][source]¶
Return the Graph application permissions needed.
- Parameters:
config – Module settings (none).
restore – Restore is not implemented yet, so it needs nothing.
- Returns:
Read permissions for backup; nothing for restore.
- event_types() list[s365b.modules.sdk.EventType][source]¶
Alerts for security-relevant directory changes.
- Returns:
The event types.
- change_event(item_type: str, change: str, version: s365b.modules.sdk.ItemVersion) str | None[source]¶
Map a change to an alert (see
CHANGE_EVENTS).- Parameters:
item_type – The item’s type.
change –
new,changedordeleted.version – The new version.
- Returns:
The event ID, or
Nonefor changes that do not alert.
- item_types() list[s365b.modules.sdk.ItemTypeInfo][source]¶
Describe the item types.
- Returns:
One entry per Graph object type.
- async discover(ctx: s365b.modules.sdk.ModuleContext) collections.abc.AsyncIterator[s365b.modules.sdk.ProtectedObject][source]¶
Yield one protected object per category.
- Parameters:
ctx – Module context.
- Yields:
The categories.
- state_for_new_repository(state: s365b.modules.sdk.SyncState) s365b.modules.sdk.SyncState[source]¶
Keep the state: every run reads everything, and it finds deletions.
- Parameters:
state – The state saved by the backup into the other repository.
- Returns:
The same state.
- async backup(ctx: s365b.modules.sdk.ModuleContext, obj: s365b.modules.sdk.ProtectedObject, state: s365b.modules.sdk.SyncState) collections.abc.AsyncIterator[s365b.modules.sdk.ItemVersion | s365b.modules.sdk.Checkpoint][source]¶
Snapshot one category.
Every object is yielded each run (the catalog keeps only changed ones); objects seen last time but not now are yielded as deleted. A checkpoint follows each source.
- Parameters:
ctx – Module context.
obj – The category.
state –
{"seen": {source key: [item keys]}}from the last run.
- Yields:
Item versions and checkpoints.
- Raises:
ModuleError – For an unknown category or missing permissions.