Dev.to Security 🔐 Cybersecurity 👁 0 📖 5 min read

A brand-new Microsoft 365 tenant failed 35 CISA checks. Here are the 6 fixes I made in 30 minutes.

Lab build. Every number and screenshot below comes from a Microsoft 365 Business Premium lab tenant I set up and scanned myself. No customer data. TL;DR A brand-new tenant, nothing changed, failed 35 of the

Lab build. Every number and screenshot below comes from a Microsoft 365 Business Premium lab tenant I set up and scanned myself. No customer data.

TL;DR

  • A brand-new tenant, nothing changed, failed 35 of the CISA SCuBA baseline checks on day one.
  • Two free tools did the scan: ScubaGear (from CISA) and Maester (open source, Microsoft MVP community).
  • I fixed 6 things in about 30 minutes. Second scan: 29 fails (pass 26 → 33). Maester: fails 116 → 102.
  • The scan ran with a Global Reader account. Read-only. Only the fixes needed an admin.

The lab

  • Microsoft 365 Business Premium trial, 7 users, 2 groups (Sales, IT).
  • Security defaults off. Microsoft then created 3 Conditional Access policies for me: block legacy authentication, MFA for admins, MFA for all users.
  • Two accounts: labadmin = Global Reader (runs the scans), labadminfull = Global Admin (clicks consent once, makes the fixes).

Read-only by design

This is the part I want you to remember. The health check never changes anything.

  • ScubaGear and Maester both run fine with Global Reader.
  • A Global Admin has to approve the Microsoft Graph read permissions one time. The scopes ScubaGear needs:
Connect-MgGraph -Scopes "Directory.Read.All","Policy.Read.All","RoleManagement.Read.Directory","User.Read.All","PrivilegedAccess.Read.AzureADGroup","PrivilegedEligibilitySchedule.Read.AzureADGroup","RoleManagementPolicy.Read.AzureADGroup"

Tick "Consent on behalf of your organization" and accept. After that the Global Reader account can run everything.

Fixing settings is a separate step. That one needs admin rights, and you plan it with the client.

Tool 1: ScubaGear

Made by CISA (the US cyber defense agency). It compares your tenant to the SCuBA secure configuration baselines. Every check has a code (for example MS.AAD.5.1) and a result: pass, fail or warning.

Run it in Windows PowerShell 5.1 (not PowerShell 7):

Install-Module -Name ScubaGear
Install-ScubaDependencies
Invoke-SCuBA -ProductNames aad,exo,securitysuite,sharepoint,teams

The report lands in a dated folder: BaselineReports.html, ScubaResults.csv, ActionPlan.csv. The scan took about 3 minutes.

Two problems I hit:

  1. Sign-in window broken. The login window inside PowerShell 5.1 uses the old Internet Explorer engine. Fix: add a registry value HKCU\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION, DWORD powershell.exe = 11001, then reopen PowerShell.
  2. Graph module too new. I had Microsoft.Graph.Authentication 2.41 installed; ScubaGear was tested up to 2.25. Fix: Reset-ScubaGearDependencies, close and reopen PowerShell.

Tool 2: Maester

Free, open source, from the Microsoft MVP community. It runs 751 small tests: the CISA checks again, the CIS Microsoft 365 benchmark, Microsoft's Entra recommendations (EIDSCA) and email protection checks (ORCA). Every fail links to the fix.

Run it in PowerShell 7.4 or newer:

Install-Module Maester -Scope CurrentUser
Install-Module ExchangeOnlineManagement, MicrosoftTeams -Scope CurrentUser
Connect-Maester -Service Graph,ExchangeOnline,Teams
Invoke-Maester

Simple way to remember the two: ScubaGear is the report you show the client. Maester is the to-do list for you.

Before the fixes

ScubaGear run 1: 26 pass / 35 fail. Maester run 1: 112 pass / 116 fail.

Product Pass Fail
Entra ID 6 17
Exchange Online 5 5
Defender / Purview 10 2
SharePoint / OneDrive 0 8
Teams 5 3

The biggest problems, in simple words:

  1. Audit log off. If someone hacks an account, there is no record of what they did.
  2. Any user can approve and create apps. One click on a fake app and an attacker can read that user's mail and files.
  3. Admins not required to use strong MFA.
  4. No DMARC. Anyone can send email that looks like it comes from your company.
  5. Teams open to anyone outside, including personal accounts.
  6. SMS and email codes allowed for MFA.
  7. SharePoint "Anyone" links that never expire.

The six fixes (about 30 minutes)

All quick, all easy to undo, all in the Entra admin center unless noted.

# Control Where Change
1 MS.AAD.5.1 Users > User settings "Users can register applications" = No
2 MS.AAD.5.2 Enterprise apps > Consent and permissions > User consent Do not allow user consent
3 MS.AAD.5.3 Enterprise apps > Admin consent settings "Users can request admin consent" = Yes, pick a reviewer
4 MS.AAD.3.5 Protection > Authentication methods SMS, Voice call, Email OTP = Off
5 MS.AAD.3.3 Authentication methods > Microsoft Authenticator Show app name = Enabled, Show location = Enabled, Authenticator OTP = No
6 MS.SECURITYSUITE.5.1 Exchange Online PowerShell Set-AdminAuditLogConfig -UnifiedAuditLogIngestionEnabled $true

Before fix 4, check that every account already has a stronger sign-in method, or you lock people out.

Two things that cost me time

Fix 5 still failed after I set both switches to Enabled. ScubaGear only said "Requirement not met". I opened the rule file (Rego\AADConfig.rego) and found a third condition: IsSoftwareOathEnabled == false. So "Allow use of Microsoft Authenticator OTP" also has to be No. Lesson: when a tool only says "not met", read the rule.

The audit log command failed on a new tenant with InvalidOperationInDehydratedContextException, even after Enable-OrganizationCustomization. The next morning the same command worked, and it took about an hour before Get-AdminAuditLogConfig showed True.

After the fixes

ScubaGear run 3: 33 pass / 29 fail. Maester run 2: 139 pass / 102 fail (and this run included the Teams tests). Both tools agree on what changed.

Product Pass before → after Fail before → after
Entra ID 6 → 11 17 → 12
Defender / Purview 10 → 12 2 → 1
Exchange Online 5 → 5 5 → 5
SharePoint / OneDrive 0 → 0 8 → 8
Teams 5 → 5 3 → 3
Total 26 → 33 35 → 29

Exchange, SharePoint and Teams did not move because I did not touch them in this round.

What is still open, and why

  • Conditional Access and device compliance. Most of the remaining Entra ID fails need a proper Conditional Access set plus Intune. You plan that with the client, run it in report-only mode for a week, then turn it on.
  • Licence-limited items. Risk-based policies and PIM need Entra ID P2.
  • DMARC. One DNS record on the company domain. One of the highest-value fixes you can make.
  • SharePoint sharing. Eight fails, one settings page.

Four lessons

  1. "Microsoft managed" is not "on". Several settings must be set explicitly before the baseline counts them.
  2. Security defaults and Conditional Access cannot run together.
  3. Declare your break-glass (emergency admin) accounts to the tool, or it flags the policy exclusions.
  4. Check sign-in methods before you switch any off.

If you run Microsoft 365 for a small company, run these two tools this week. Read-only, about 30 minutes.

Links

Lab build. Lab tenant only, no customer data. Tenant ID and domain are hidden in every screenshot.

Thanks for reading! I'm Cuong, and on CD Security Lab I rebuild real Microsoft security cases in a safe lab and explain them simply. Follow along:

Got a question about your own tenant? Drop it in the comments.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.