Microsoft 365 Tenant Changes and Audits

Get tenant-scoped PowerShell, change previews, and verification for Microsoft 365 users, licenses, mail, Teams, and access.

Development / DevOps & Inframicrosoft-365powershell
by AgentVoltv1.0.0
Free to sign up · every skill included with AgentVolt Pro

Before & after

Same prompt, same agent — the only difference is the skill.

Prompt“Onboard 40 new hires into our M365 tenant next Monday.”
Beforegeneric AI agent
Onboarding 40 new users to Microsoft 365 involves several steps:

1. Create the user accounts in Azure AD (now Microsoft Entra ID)
2. Assign appropriate licenses to each user
3. Add users to relevant security groups and distribution lists
4. Configure their mailboxes in Exchange Online
5. Add them to the appropriate Teams

You can do this through the admin center UI, but for 40 users you'd probably want to use PowerShell. You'll need the Microsoft Graph PowerShell SDK installed.

A CSV file with the user details would be the easiest way to handle a bulk import.

Let me know if you'd like help with the PowerShell commands!
Afterwith Microsoft 365 Tenant Changes and Audits
BULK ONBOARD — 40 users

Prereq: Connect-MgGraph -Scopes "User.ReadWrite.All","Group.ReadWrite.All","Organization.Read.All"

STEP 0 — LICENSE CHECK FIRST (this is what fails Monday morning)
  Get-MgSubscribedSku | Select SkuPartNumber,
    @{n='Available';e={$_.PrepaidUnits.Enabled - $_.ConsumedUnits}}
  40 seats must be free BEFORE the loop. A mid-run license exhaustion
  leaves you with half-provisioned accounts and no clean rollback.

STEP 1 — CSV
  UserPrincipalName,DisplayName,Department,JobTitle,ManagerUPN,UsageLocation

STEP 2 — CREATE (idempotent — safe to re-run after a partial failure)
  Import-Csv .\newhires.csv | ForEach-Object {
    if (Get-MgUser -Filter "userPrincipalName eq '$($_.UserPrincipalName)'" -EA SilentlyContinue) {
      Write-Warning "exists, skipping: $($_.UserPrincipalName)"; return
    }
    $pw = @{ ForceChangePasswordNextSignIn = $true; Password = (New-Password) }
    New-MgUser -UserPrincipalName $_.UserPrincipalName -DisplayName $_.DisplayName `
      -MailNickname ($_.UserPrincipalName -split '@')[0] -AccountEnabled `
      -UsageLocation $_.UsageLocation -PasswordProfile $pw
  }

  UsageLocation is not optional — license assignment fails without it, and
  the error message doesn't say so.

STEP 3 — LICENSE + GROUPS
  Prefer group-based licensing over per-user: add to the group, licensing
  follows, and offboarding is one removal instead of three.

STEP 4 — CONDITIONAL ACCESS
  Confirm new hires land in scope of the MFA policy. A CA policy scoped to
  a static group silently excludes everyone created after it was written.

STEP 5 — VERIFY
  Compare CSV count to Get-MgUser results; export mismatches. Don't trust
  the loop's own output — it reports what it attempted, not what stuck.

Run steps 1–2 against 2 test rows Friday. Monday is not the day to find
out about UsageLocation.

About this skill

“The bulk script finished, but did it change the right accounts?” Microsoft 365 administration spans identity, licensing, mail, collaboration, and security systems that do not share one transaction or rollback button. This skill produces scoped PowerShell and change plans that resolve targets before writing, preview exact changes, and verify each workload afterward.

What it does

  • Builds bulk provisioning and account-change scripts with CSV validation, immutable object IDs, duplicate detection, and tenant checks.
  • Separates direct and group-based licensing, checks SKU capacity and dependencies, and explains why disabling an account may not release a seat.
  • Sequences offboarding around account access, session revocation, mailbox access, OneDrive ownership, retention, and license removal.
  • Drafts Conditional Access changes with emergency-access exclusions, report-only evaluation, and pilot rollout criteria.
  • Scopes Exchange Online mail-flow and Teams changes, captures prior settings, and provides workload-specific readback checks.
  • Produces security and compliance inventories that distinguish configuration evidence from demonstrated enforcement.

What you get

A task-sized answer: a targeted correction, a read-only audit, or self-contained PowerShell with a preview, explicit apply path, per-object results, and recovery guidance. Unsupported automation and unverified prerequisites are identified before they become production assumptions.

Best for

Microsoft 365 administrators and managed service providers handling tenant setup, bulk user operations, licensing, offboarding, Exchange Online, Teams, or access-policy changes.

SKILL.md preview

SKILL.md
---
name: microsoft-365-tenant-changes-and-audits
description: >-
  Plan, script, and audit Microsoft 365 tenant administration using Microsoft Graph, Exchange Online, and Teams PowerShell, with resolved targets, explicit previews, staged changes, and workload-specific verification. Use when the user says "bulk create these users", "my license assignment keeps failing", "offboard these employees", "audit our Microsoft 365 tenant", "fix this Exchange mail-flow rule", "roll out Conditional Access", or "my Teams policy is not applying".
---

# Microsoft 365 Tenant Changes and Audits

… (sign up to view the full skill)
Sign up to view, copy, and install the full skill

More development skills

View all Development skills →