MSP StockroomFind a guide, template or tool…/
Curated SOPs / Microsoft 365 and identity

M365 Curated SOP / Microsoft 365 and identity

Check SPF, DKIM and DMARC for a client's mail domains

Find out whether each of a client's mail domains tells the rest of the internet which mail is really theirs.

Low risk / Read-only / Reviewed December 2, 2026

Written and maintained by MSP Stockroom. Nobody else edits it.

On this page

Before you run anything: read every command first and understand what it does. Replace example names, domains and addresses with your own. Try it on a test device or tenant before a client's. Keep client names, passwords and keys out of tickets and chat.

Purpose

Find out whether each of a client's mail domains tells the rest of the internet which mail is really theirs. Without SPF, DKIM signing and a DMARC policy, anyone can send mail that looks like it came from the client, which is how most invoice and payroll fraud starts. Run it at onboarding, after adding a domain or a new sending service (a newsletter tool, a ticketing system, a scanner), and at each security review. Read-only: nothing in this SOP changes DNS or the tenant.

Scope and prerequisites

  • Run by the client's assigned engineer.
  • Needs an account that can read the Exchange Online configuration, such as Global Reader or Security Reader.
  • The Exchange Online PowerShell module installed from the PowerShell Gallery.
  • A Windows device for the DNS lookups in step 3 (Resolve-DnsName ships with Windows).
  • A list of every domain the client owns, including domains that never send mail.
  • Store the results in your documentation platform, never in this library.

Steps

  1. Sign in to Exchange Online:
    # You will be asked to sign in to the client's tenant.
    Connect-ExchangeOnline
  2. List the client's domains and their DKIM signing status:
    Get-AcceptedDomain | Select-Object DomainName, DomainType, Default
    
    Get-DkimSigningConfig |
        Select-Object Name, Enabled, Status, Selector1KeySize, Selector2KeySize, RotateOnDate

    Read the result:

    • Enabled True and Status Valid: Microsoft 365 signs mail from that domain.
    • Enabled False, or Status CnameMissing or NoDKIMKeys: mail from that domain is not DKIM signed. Record it as a finding.
    • A domain from Get-AcceptedDomain that is missing from Get-DkimSigningConfig has no DKIM set up at all. Record it as a finding if the domain sends mail.
  3. Read the SPF and DMARC records for each domain. Replace the example domain list with the client's domains:
    $domains = 'example.com', 'example.org'
    foreach ($d in $domains) {
        $spf = Resolve-DnsName -Name $d -Type TXT -ErrorAction SilentlyContinue |
            Where-Object { ($_.Strings -join '') -like 'v=spf1*' }
        $dmarc = Resolve-DnsName -Name "_dmarc.$d" -Type TXT -ErrorAction SilentlyContinue |
            Where-Object { ($_.Strings -join '') -like 'v=DMARC1*' }
        [pscustomobject]@{
            Domain     = $d
            SpfRecords = @($spf).Count
            Spf        = ($spf | ForEach-Object { $_.Strings -join '' }) -join ' | '
            Dmarc      = ($dmarc | ForEach-Object { $_.Strings -join '' }) -join ' | '
        }
    }
  4. Compare each domain with this table and record every line marked review:

| Check | Good | Review if | | --- | --- | --- | | SPF record count | exactly 1 | 0, or more than 1 (two SPF records break SPF) | | SPF ending | -all | ~all or ?all, or no all at the end | | SPF senders | every service that sends as the domain | a service you know sends mail is missing | | DKIM | Enabled True, Status Valid | anything else, for a domain that sends mail | | DMARC policy | p=reject, or p=quarantine on the way there | no record, or p=none left in place with nobody reading the reports | | DMARC reports | rua= points at a mailbox or service someone reads | no rua= | | Domains that never send | SPF v=spf1 -all and DMARC p=reject | anything weaker |

  1. Disconnect when finished:
    Disconnect-ExchangeOnline -Confirm:$false

Verify

Every domain the client owns has a line in your record with its SPF, DKIM and DMARC state, and each line marked review has an owner and a next step.

Rollback

Nothing to roll back; this SOP only reads. Changing SPF or moving DMARC to quarantine or reject is a separate change, made with the client's approval. Move one step at a time and read the DMARC reports between steps, because a sending service you did not know about will start to fail.

Notes

SPF allows at most 10 DNS lookups; a long chain of include: entries can push a domain past that and break SPF without any error you can see in the tenant. Microsoft recommends -all for Microsoft 365 domains once DKIM and DMARC are in place, and a gradual move from p=none to p=quarantine to p=reject. See https://learn.microsoft.com/defender-office-365/email-authentication-dmarc-configure for Microsoft's guidance.

Sources and notes

Curated SOP from the MSP Stockroom SOP library (curated/m365-identity/check-spf-dkim-and-dmarc-for-a-clients-mail-domains.md). Last reviewed December 2, 2026. Tested on: Not yet run; written for Exchange Online PowerShell module 3.x; Windows PowerShell 5.1 or PowerShell 7.4 on Windows. Vendor screens and commands change; check the vendor documentation before you rely on a step. Found a mistake? See corrections.

Search the stockroom

↑ ↓ to choose · Enter to open · Esc to close

Open the full search page →