Excluded: .git, node_modules, secrets/, compose.env, assemblyscript tgz Source: /opt/alga-psa on psa.joliet.tech
5.4 KiB
Microsoft Entra Integration (EE) — Phase 1 Setup and Usage
Scope
This guide documents Enterprise Edition Phase 1 of Microsoft Entra integration:
- Partner-level connection (
directMicrosoft OAuth orcippAPI token). - Managed tenant discovery and tenant-to-client mapping.
- Initial/manual/recurring contact sync through Temporal workflows.
- Additive, non-destructive sync behavior.
All user-visible Entra surfaces are feature-flag gated.
Prerequisites
- Edition:
NEXT_PUBLIC_EDITION=enterprise - Internal MSP user account (client portal users are denied)
- RBAC:
- View endpoints/actions:
system_settings.read - Connect/map/sync/resolve endpoints/actions:
system_settings.update
- View endpoints/actions:
Connection Path Decision Guide
Choose one connection type per tenant:
direct(Microsoft OAuth)
- Use this when you want first-party delegated auth directly against Microsoft Graph.
- Requires Microsoft OAuth app credentials (tenant secret, env, or app secret fallback).
- Best when you control OAuth app registration and consent flow.
cipp(CIPP API)
- Use this when CIPP is your operational control plane for managed tenant/user enumeration.
- Requires CIPP base URL and API token.
- Best when your MSP already uses CIPP and wants to reuse that API boundary.
Switching connection types automatically clears stale credentials for the previous type.
Required Secret Names
Entra secret constants are defined in ee/server/src/lib/integrations/entra/secrets.ts.
Shared Microsoft credential keys:
microsoft_client_idmicrosoft_client_secretmicrosoft_tenant_id
Direct Entra token keys:
entra_direct_access_tokenentra_direct_refresh_tokenentra_direct_token_expires_atentra_direct_partner_tenant_identra_direct_token_scope
CIPP keys:
entra_cipp_base_urlentra_cipp_api_token
Secret provider compatibility:
- All Entra credentials/tokens are resolved through
getSecretProviderInstance(). - Tenant secrets support env/filesystem/vault provider chains (no plaintext token storage requirement in DB).
Credential Resolution Order (Direct)
For direct Microsoft OAuth credentials, resolution order is:
- Tenant secrets (
microsoft_client_id+microsoft_client_secret, optionalmicrosoft_tenant_id) - Environment variables (
MICROSOFT_CLIENT_ID,MICROSOFT_CLIENT_SECRET,MICROSOFT_TENANT_ID) - App secrets (
MICROSOFT_CLIENT_ID,MICROSOFT_CLIENT_SECRET,MICROSOFT_TENANT_ID)
Feature Flags (Phase 1)
Required flags:
entra-integration-uientra-integration-client-sync-actionentra-integration-cippentra-integration-field-syncentra-integration-ambiguous-queue
Create/check default Phase 1 flag definitions through platform feature flag API:
curl -X POST \
"$BASE_URL/api/v1/platform-feature-flags" \
-H "Content-Type: application/json" \
-H "x-api-key: $MASTER_TENANT_API_KEY" \
-d '{"__action":"ensure_entra_phase1_flags"}'
Enable tenant targeting for a flag:
curl -X POST \
"$BASE_URL/api/v1/platform-feature-flags/$FLAG_ID/tenants" \
-H "Content-Type: application/json" \
-H "x-api-key: $MASTER_TENANT_API_KEY" \
-d '{"__action":"add","tenantId":"TENANT_UUID"}'
Setup Workflow (Wizard)
The settings wizard follows four explicit write-gated steps:
- Connect
- Choose
directorcipp. - For direct: start OAuth, complete callback, validate connection.
- For CIPP: save base URL/token, validate tenant list access.
- Discover Tenants
- Run discovery to populate managed Entra tenants.
- Map Tenants to Clients
- Review
auto-matched,needs review, and skipped rows. - Confirm mappings explicitly (no hidden writes during preview).
- Initial Sync
- Run initial sync once at least one mapping is confirmed.
Sync Behavior and Safety Rules
Default behavior is additive/linking, not destructive:
- Email-normalized match links to existing contacts.
- No match creates new contact under mapped client.
- Multiple plausible matches queue reconciliation items.
- Name-only similarity does not auto-link.
- Sync never deletes contacts.
- Disabled/deleted upstream Entra users mark linked contacts inactive.
Field overwrite controls:
- Only fields enabled in
entra_sync_settings.field_sync_configmay overwrite local contact values. - If a field toggle is off, local value remains authoritative.
Manual Sync Paths
- Settings:
Sync All Tenants Nowstarts all-tenant workflow. - Client details:
Sync Entra Nowstarts single-client workflow for mapped client. - Mapping confirm flow can optionally start initial sync immediately.
All sync execution paths run via Temporal workflows and persist run + per-tenant results.
Rollout Order (Recommended)
- Deploy schema + EE code with all Entra flags disabled.
- Ensure Phase 1 flags exist using
ensure_entra_phase1_flags. - Enable
entra-integration-uifor internal test tenants only. - For test tenants needing CIPP, enable
entra-integration-cipp. - Validate discovery and mapping quality on pilot tenants.
- Enable
entra-integration-field-synconly after field overwrite policy is approved. - Enable
entra-integration-ambiguous-queuefor support teams handling reconciliation. - Enable
entra-integration-client-sync-actionafter mapping/sync operations are stable. - Expand tenant targeting incrementally.
Turning UI flags off hides Entra surfaces immediately without deleting connection/mapping/run history data.