14 actions. Zero manual steps. One email from HR triggers everything — from blocking sign-in to deleting the account 30 days later.
Most offboarding checklists get missed. Trasoltech built a fully automated Microsoft 365 offboarding flow using Power Automate and Microsoft Graph API - so nothing is forgotten, no matter how fast someone leaves.
When an employee leaves, IT has to move fast. Every minute an account stays active after someone's last day is a security exposure. But manual offboarding is slow, inconsistent, and error-prone.
At Trasol, our offboarding process previously involved logging into Azure AD, Exchange Admin Center, Teams Admin, SharePoint, and the licensing portal - individually, manually, every time. Steps got missed. Licenses stayed assigned for weeks. Mailboxes were never converted. Sessions were revoked hours after the employee had already been notified.

We built a fully automated offboarding flow using Power Automate, Microsoft Graph API, and Azure Automation. HR sends one email. Everything else happens automatically.
The flow is triggered when HR sends an email to offboarding@domain.com (customizable) with subject "Employee Offboarding". A trigger condition restricts activation to emails from hr@domain.com only - preventing loops from automated replies. Four variables are extracted from the email body: Employee Email, Manager Email, Last Working Day, and Reason.
The moment the flow triggers, four security actions fire via Microsoft Graph API: block sign-in, revoke all active sessions, reset password, and remove from all Azure AD groups and Teams. Dynamic groups are detected and skipped automatically. Individual failures don't stop the flow.
Microsoft Graph API cannot convert a mailbox to shared or set delegation. We solved this with an Azure Automation runbook triggered via webhook from Power Automate. The PowerShell runbook connects to Exchange Online using Managed Identity and handles three things: convert to shared mailbox, grant the manager full access, and forward all new emails to the manager.
The flow retrieves all assigned licenses and removes them in a loop - handling users with multiple licenses automatically. Out of Office is set, and the user is hidden from the Global Address List so they no longer appear in directory searches or email autocomplete.
A confirmation email is sent to the manager and HR listing every completed action. A row is automatically created in a SharePoint Offboarding Tracker list with the employee's details, reason, and timestamp - giving you a permanent compliance record.
After all steps complete, a 30-day delay runs in the background. When the retention period ends, the account is permanently deleted via Graph API. Each offboarding run is independent — multiple employees can be offboarded simultaneously. Runs can be cancelled before 30 days if account recovery is needed.
The biggest technical hurdle was mailbox conversion and delegation. Microsoft Graph API does not support converting a user mailbox to a shared mailbox - this is an Exchange Online-only operation. Neither does it support setting Full Access delegation the same way.
Our solution was to build an Azure Automation Account with a PowerShell runbook that connects to Exchange Online via Managed Identity. Power Automate calls the runbook via webhook - no credentials in the flow, no secrets exposed. The Managed Identity was granted Exchange Administrator role in Entra ID and registered as a Service Principal in Exchange Online with the required management role assignments.

| Before | After |
| 2–3 hours manual IT effort | Under 5 minutes, fully automated |
| Inconsistent - steps missed regularly | 14 actions executed in sequence every time |
| No audit trail | Full log in SharePoint + Azure job history |
| Sessions revoked hours after notification | Sessions revoked instantly on trigger |
| Mailbox conversion forgotten | Shared mailbox + delegation - always done |
| Licenses left assigned for weeks | Licenses removed same day |
| Account deletion indefinitely delayed | Automated at 30 days - consistent every time |
What Powers the Automation

We can implement the same solution in your Microsoft 365 tenant - scoped to your HR process, your tools, and your compliance requirements.