Every domain that sends mail from Exchange Online should publish an SPF record
This check looks at the DNS records of each domain accepted in Exchange Online and whether a valid SPF record is published that includes Microsoft's mail servers. The safe setting is that every sending domain has an SPF record that lists the services allowed to send for it.
Why it matters
SPF is a DNS record that lists which servers may send mail for your domain. A receiving server compares the sending server with that list. If there is no record, anybody can send mail that claims to be from your domain and the receiver has nothing to check it against, which makes spoofing of your name easier.
Microsoft describes the record Exchange Online expects in Set up SPF to help prevent spoofing. SPF is one of three mail authentication methods that work together with DKIM and DMARC.
How to check it yourself
In the Microsoft 365 admin center open Settings, Domains, select a domain and look at its DNS records. The record type TXT with a value starting v=spf1 is the SPF record. You can also query public DNS from any machine.
These commands only read data.
Connect-ExchangeOnline
Get-AcceptedDomain | ForEach-Object {
$txt = Resolve-DnsName $_.DomainName -Type TXT -ErrorAction SilentlyContinue |
Where-Object { $_.Strings -match '^v=spf1' }
[pscustomobject]@{ Domain = $_.DomainName; Spf = ($txt.Strings -join ' ') }
}An empty Spf column is a gap. A record that does not contain include:spf.protection.outlook.com means Exchange Online is not listed as an allowed sender.
How to fix it
Sign in to the place where the domain's DNS is managed and add or edit one TXT record at the root of the domain. A domain that sends only through Microsoft 365 uses this value:
v=spf1 include:spf.protection.outlook.com -allA domain must have only one SPF record. If one exists already, add the include to it instead of creating a second record. If other services also send mail for the domain, add their include entries before the final -all.
Exchange Online has no cmdlet that edits public DNS, so this step is done at your DNS provider or with that provider's own tooling. ConfigCobra itself never changes the tenant or your DNS.
What changes when you fix it
The affected parties are every sender that uses the domain name and the person who runs DNS. Normal Microsoft 365 mail continues as before.
- Mail from other systems that use your domain, such as a CRM, a ticket system, a newsletter tool or a scanner, fails SPF if it is not listed. List all legitimate senders first.
- The ending of the record matters. A strict -all tells receivers to reject unlisted senders, a softer ~all only marks them. Many teams start soft and tighten once they have seen the real senders.
- Receivers can take some time to pick up the new record because of DNS caching.
Ask the owners of each department tool which of them send as your domain before you publish a strict record.
Included in
| Benchmark | CIS ID | Profile |
|---|---|---|
| CIS Microsoft 365 Foundations v7.0.0 | 2.1.8 | E3 Level 1 |
More checks in Microsoft Defender
- Safe Links for Office Applications should be enabledCIS 2.1.1
- The common attachment types filter should be enabledCIS 2.1.2
- Notifications for internal users sending malware should be enabledCIS 2.1.3
- Safe Attachments policy should be enabledCIS 2.1.4
- Safe Attachments for SharePoint, OneDrive, and Microsoft Teams should be enabledCIS 2.1.5
Go further
- Microsoft Defender21 controls in this section
- CIS Microsoft 365 Foundations v7.0.0160 controls
- CIS Microsoft 365 Foundations checklistEvery control in one list, as CSV
- RemediationSee what a fix changes in your tenant before you apply it, then use the generated script
- Monitoring & DriftScheduled scans, drift detection and email alerts when a control regresses
Check this on your Microsoft 365
ConfigCobra runs this check with every other control of the CIS Microsoft 365 Foundations Benchmark, read-only.