Skip to content
Menu

New Client Tenant - Microsoft 365 Onboarding Audit

One read-only pass over a new tenant that writes a row per finding with a severity: High, Medium, Low or Info. A check the app cannot run shows as Not checked, not as a failure.

New client tenant - Microsoft 365 onboarding audit is free for members.

Enter your email to create your free account and get the file.

We'll email you the script and the weekly MSP Outpost email. Unsubscribe anytime. Privacy policy.

Already a member? Sign in.

Be the first to review New client tenant - Microsoft 365 onboarding audit. Tell other MSPs how it worked for you.

Write a Review

LanguagePowerShell
Runs onWindows 10, 11, Server 2016+, with the app certificate; runs as SYSTEM or a user
NeedsPowerShell 5.1; Graph read permissions (see the script); Entra ID P1; Exchange app access for CheckExchange
Read-onlyReads, changes nothing

What It Does

The script signs in to one client tenant as your app and only reads. It writes one row per finding with an Area, a Finding, a Value, a Severity and the evidence in Detail. The answer counts the findings by severity and says how many checks could not run.

It reports subscribed licenses with units used and bought, who holds active Global Administrator assignments, whether security defaults are on, and how many Conditional Access policies are enabled, report-only or disabled. Defaults off with zero enabled policies is High. The check counts policies and does not evaluate whether a policy requires MFA. It also reports MFA registration for members and administrators, guest count, and SharePoint and OneDrive sharing levels, flagging Anyone links.

With CheckExchange set to true it also reads whether the unified audit log is on and lists mailboxes that forward mail, High when a forward goes to an external address. Without the Exchange module, those two rows say Not checked and the rest still runs.

A check the app is not allowed to run becomes a Not checked row with the service's own error. The run ends ERROR only when every check failed. Only active role assignments are listed; eligible assignments in Privileged Identity Management are not.

Before You Run It

  • Register the app in the client's tenant and grant admin consent for the read permissions named in the header.
  • Upload the certificate to the app and install it with its private key on this computer.
  • The MFA registration report needs Entra ID P1 or P2. Without it that row says Not checked.
  • Add CheckExchange only when the ExchangeOnlineManagement module is installed and the app has Exchange.ManageAsApp and a read role such as Global Reader.
  • Use ExportPath to save the findings as a file for the onboarding record.

Type and Risk

  • Type: Report. It collects facts into a table and never alerts. It exits 0, or 2 when it could not run.
  • Risk: Low. It reads and changes nothing.
  • Restart: It never restarts the machine.
  • Typical run: Under 2 minutes.
  • Example answer: "Tenant audit: 16 findings; 2 High, 3 Medium, 1 Low; 0 not checked"
  • Tested before listing with Windows PowerShell 5.1, run as SYSTEM, against its own test cases and a Microsoft 365 Business Premium test tenant.

Inputs

Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.

  • TenantId: The client tenant: its ID (a GUID) or a domain such as contoso.onmicrosoft.com. Required.
  • ClientId: The app registration's Application (client) ID, a GUID. Required.
  • CertificateThumbprint: Thumbprint (40 hex characters) of the app's certificate, which must be installed with its private key in LocalMachine\My or CurrentUser\My on this computer. Preferred. When empty, the app secret is read from the environment variable ClientSecret (a secure RMM field).
  • CheckExchange: true to also check the unified audit log and mailbox forwarding through Exchange Online PowerShell. Default false.

Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.

License

Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.

The Script

get-tenant-onboarding-audit.ps1 · 1145 lines · 67.3 KB

Free for Members

Create a free account or sign in to read, copy and download this script.

Welcome Back

Sign in to your MSP Outpost account.