Purview Script
Automated version of Troubleshooting Purview activation errors and delays. It connects to Exchange Online, forces a disable then re-enable of audit log ingestion, and confirms the result. If the tenant is dehydrated, it runs Enable-OrganizationCustomization, waits for it to finish, then re-enables audit logging. If activation is genuinely refused, it prints a diagnostic (account roles, tenant hydration, license and subscription status).
Run it
Verify later
False right after the run is normal: Microsoft applies it within a few minutes (up to about 60 min). Reconnect to check:
Connect-ExchangeOnline -UserPrincipalName <admin@clientdomain.com> -ShowBanner:$false
Get-AdminAuditLogConfig | Format-List UnifiedAuditLogIngestionEnabledTrue means it is done.
If it fails
The script runs a diagnostic and tells you which case you are in. Send the .log file it created to protect@stoik.io.
Dehydrated tenant: handled automatically. The script runs
Enable-OrganizationCustomization, waits for hydration, then re-enables audit logging.403 Forbidden / refused: a real rejection. The account lacks the right role (the Audit Logs role, granted through Organization Management or Compliance Management), or the tenant has no license that includes Exchange Online.
Server-side error: a transient "try again later" from Microsoft. The script already retries; if it persists, run it again a few minutes later.
Last updated
Was this helpful?

