Skip to content
M365-02 Field-tested

Block sign-in on shared mailboxes

Shared mailbox accounts have passwords that never rotate. Block sign-in. Delegated access keeps working.

Why

Every shared mailbox has a user account with a system-generated password that never rotates. If sign-in is allowed, that account is a standing target for password spray, and it’s usually excluded from MFA.

Safe to do

Blocking sign-in doesn’t affect users who open the mailbox through Full Access or Send As delegation. They sign in as themselves.

Fix

Connect-MgGraph -Scopes "User.ReadWrite.All"
Connect-ExchangeOnline
Get-Mailbox -RecipientTypeDetails SharedMailbox -ResultSize Unlimited | ForEach-Object {
  Update-MgUser -UserId $_.ExternalDirectoryObjectId -AccountEnabled:$false
}

Or block sign-in per mailbox in the Microsoft 365 admin center (Users → the shared mailbox → Block sign-in).

Verify

Delegates can still open the mailbox in Outlook, and the shared mailbox accounts show Sign-in blocked.

Seeing this in your environment?

We can check for this, and everything around it, as part of an audit.

Ask us about M365-02

Find out what's really going on in your tenant.

Tell us what you run and what's worrying you. We'll recommend the right audit, and tell you honestly if you don't need one.