Skip to main content

scalio-m365

Shared code that reads («Scalio Lesen») and writes («Scalio Schreiben») Microsoft 365 settings of a live tenant: one reader and one writer per Microsoft365DSC resource type (Entra ID, SharePoint, Intune, Exchange Online / Defender for Office 365), with the property names of the governance catalog (scalio-catalog). Foundry rolls baselines out with it, Citadel heals deviations. Decision: scalio-docs concepts/m365-schreibpaket.md (m365pkg/P1–P4), ADR 0089.

Nothing in this package is secret and it holds no content: the baselines stay in the private repo scalio_blueprint, tokens and certificates stay in the app (scalio-tenant).

Use in an app

import scalio_m365 as m365

g = m365.Graph(call, exo, create=True)        # Foundry; Citadel: create=False (keeps existing objects only)
reason = m365.why_not(type_, desired)          # Citadel: why_not(type_, desired, change_only=True)
actual = await m365.read_one(g, type_, match)  # catalog names
after = m365.fields(type_, {**(actual or {}), **desired})
if not m365.same(actual, after):
    await m365.kind(type_).write(g, actual, after)
  • call(method, path, body) -> dict: one Microsoft Graph call (path relative to /v1.0, or a full @odata.nextLink); raise on an error. exo(cmdlet, parameters) -> list[dict]: one cmdlet through the Exchange admin API (InvokeCommand, app-only token). The app brings token, HTTP client and logging.
  • WriteError: the step cannot be written as asked (missing group, empty break-glass group, object missing, no reviewer, no notification address); the text says what to do.
  • SCOPES (Graph permissions), exchange.SCOPES, DIRECTORY_ROLES, READ_ALONG and needs(type_): what the «Scalio Schreiben» registration needs.
  • Exchange in a fresh tenant: exchange.prepare(g, is_dehydrated=..., customised_at=...) runs Enable-OrganizationCustomization once and says when to wait; the app stores the time.
  • scalio_m365.mapping: pure name mappings (Graph answer -> catalog names) for the apps' readers.

Read

from scalio_m365 import readers

resources, fields, problems = readers.read(graph_token, types, client=httpx.Client(timeout=60),
                                           tokens=admin_token, tenant=tenant_id, app="ScalioCitadel")
  • resources: {"type", "properties"} with the catalog names (ids of groups, users, roles and locations become display names, as in DSC). fields[type]: the properties read; a type left out counts as «not read», never as a deviation. problems[type]: why Microsoft refused a type (missing permission ...); a 401 of Graph stops the read.
  • Graph v1.0/beta for Entra, SharePoint and Intune; Exchange through the Exchange admin API and Teams through the Teams admin API with app-only tokens from tokens(resource) (readers.EXO_RESOURCE, readers.TEAMS_RESOURCE).
  • READERS (type -> reader), FIELDS, DYNAMIC (types whose answer decides the fields), ADMIN_APIS.
  • scalio_m365.testing.FakeMicrosoft: fake Graph and Exchange for the apps' tests.

Modes

Foundry (create=True) Citadel (create=False, change_only=True)
Entra, SharePoint creates or changes creates or changes
Intune policy missing creates (compliance with a block action) refuses: create it with its assignments first
Exchange policy missing Defender policies with a rule per accepted domain, DKIM refuses
Names of Intune/Exchange objects set on create never changed (why_not says so)

Development

pip install -e ".[dev]"
pytest && ruff check .

Release: bump pyproject.toml and __version__, reserve the version in scalio-docs REGISTER.md, run tools/changelog.py --repo scalio-m365 release <version> there, then «Freigeben» in the cockpit (workflow publish.yml, PyPI trusted publishing, environment pypi). Tags without v.

Metadata

Release files for scalio-m365 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scalio-m365 0.2.0
File Size Uploaded Provenance Actions
scalio_m365-0.2.0.tar.gz 42.5 kB With provenance Details for scalio_m365-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for scalio-m365 0.2.0
File Interpreter ABI Platform Actions
scalio_m365-0.2.0-py3-none-any.whl Python 3 none any Details for scalio_m365-0.2.0-py3-none-any.whl

Total release size: 75.2 kB

Release files / scalio_m365-0.2.0.tar.gz

Download URL scalio_m365-0.2.0.tar.gz
Size 42.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a447213784527bc97b14b11ed6ad8c131448fd08262b9b1dd770ee7d5809e108
BLAKE2b-256 checksum
How to use checksums
35fcbdfba5614973f035f23fd0745330e98110e36b2d36edfc92a832d27ab969
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Release files / scalio_m365-0.2.0-py3-none-any.whl

Download URL scalio_m365-0.2.0-py3-none-any.whl
Size 32.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea8f902cfb8a09e6f539cfa6678b908ad53bedfc0ef1bbeb85fc4f3a5214ef78
BLAKE2b-256 checksum
How to use checksums
8ab188a84c15b89b313957531733eda7452173faba3a7fc84ab4f831d0be6e86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

Security for scalio-m365 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for scalio_m365-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page