s365b.setup.provision¶
Create or update the app registrations with a delegated admin token.
Idempotent: apps are found again by their s365b:<purpose> tag and
updated in place, so the wizard can be re-run (to add permissions for a
newly enabled module, renew certificates, or repair a half-finished run).
Entra replicates new objects between regions for a few seconds; calls that depend on a just-created object are retried.
Attributes¶
Exceptions¶
Provisioning cannot continue. The message is safe to show. |
Classes¶
What one app registration should look like. |
|
An app registration after provisioning. |
|
Everything the wizard needs to store. |
|
Creates and updates app registrations in one tenant. |
Functions¶
|
Stable ID for one of the sign-in app's roles (same in every tenant). |
Module Contents¶
- exception s365b.setup.provision.ProvisionError[source]¶
Bases:
ExceptionProvisioning cannot continue. The message is safe to show.
- s365b.setup.provision.role_id(value: str) str[source]¶
Stable ID for one of the sign-in app’s roles (same in every tenant).
- Parameters:
value – App role value such as
S365B.Admin.- Returns:
The role’s GUID.
- class s365b.setup.provision.AppPlan[source]¶
What one app registration should look like.
- Variables:
purpose – Which app.
app_permissions – Microsoft Graph application permissions to grant.
delegated_scopes – Graph delegated scopes to consent for all users.
redirect_uri – Web redirect URI (sign-in app only).
previous_certificate – Base64 DER of the certificate in use now. It stays registered next to the new one, so running jobs and not-yet-replicated Entra servers keep working during rotation; the next rotation drops it.
- purpose: s365b.db.models.AppPurpose[source]¶
- class s365b.setup.provision.AppResult[source]¶
An app registration after provisioning.
- Variables:
purpose – Which app.
client_id – Application (client) ID.
object_id – Application object ID.
service_principal_id – Enterprise application object ID.
certificate – New credential (private key to be stored encrypted).
permissions – Graph application permissions now granted.
- purpose: s365b.db.models.AppPurpose[source]¶
- certificate: s365b.setup.certs.AppCertificate[source]¶
- class s365b.setup.provision.ProvisionResult[source]¶
Everything the wizard needs to store.
- Variables:
tenant_id – Directory ID.
tenant_name – Organisation display name.
default_domain – Default verified domain.
admin_upn – The admin who signed in.
apps – Provisioned apps by purpose.
- apps: dict[s365b.db.models.AppPurpose, AppResult][source]¶
- class s365b.setup.provision.Provisioner(graph: s365b.graph.client.GraphClient, report: Report, *, sleep: collections.abc.Callable[[float], collections.abc.Awaitable[None]] = asyncio.sleep)[source]¶
Creates and updates app registrations in one tenant.
- Parameters:
graph – Graph client authenticated with the admin’s delegated token.
report – Async callback
(step, status, detail)for progress.sleep – Sleep function (replaced in tests).
- async run(plans: collections.abc.Iterable[AppPlan]) ProvisionResult[source]¶
Provision every planned app.
- Parameters:
plans – The apps to create or update.
- Returns:
Tenant details and the provisioned apps.
- Raises:
ProvisionError – If a permission is unknown or the admin lacks rights.
s365b.graph.client.GraphError – For other Graph failures.