# Microsoft 365 (Office 365) SPF, DKIM and DMARC records

Exact SPF, DKIM and DMARC records for Microsoft 365 (Office 365): the values to paste, the Defender DKIM switch and a safe DMARC rollout.

Canonical URL: https://dmarcdone.com/guides/microsoft-365 | Published: 2026-10-05

This guide is for businesses on Microsoft 365 (Office 365, Exchange Online, Outlook) with their own domain, such as `example.com`. It gives the exact values of the three records Microsoft recommends, and the order to add them in.

Microsoft 365 does not hold these records for your custom domain. They go in at your DNS host, the company where your domain's DNS records live, which is often where you bought the domain. Microsoft's own words: "There are no admin portals or PowerShell cmdlets in Microsoft 365 for you to manage SPF records in your domain."

## The records at a glance

| Record | Type | Host | Value |
|---|---|---|---|
| SPF | TXT | `@` | `v=spf1 include:spf.protection.outlook.com -all` |
| DKIM 1 | CNAME | `selector1._domainkey` | copy from Microsoft (see below) |
| DKIM 2 | CNAME | `selector2._domainkey` | copy from Microsoft (see below) |
| DMARC | TXT | `_dmarc` | `v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com; fo=1` |

## SPF: one TXT record at the root

SPF (Sender Policy Framework) lists the servers allowed to send mail for your domain. If Microsoft 365 is the only service that sends mail as you, Microsoft's recommended record is:

```text
Type:  TXT
Host:  @
Value: v=spf1 include:spf.protection.outlook.com -all
```

Microsoft recommends `-all` (hard fail) rather than `~all` (soft fail) for Microsoft 365 domains. Its reason: DMARC treats both as failures, but "the DMARC policy is effectively ignored for SPF `~all` failures if the messages don't also contain DKIM signatures."

If other services also send as your domain, for example a newsletter tool or an invoicing system, add their `include:` values before `-all` in the same record:

```text
v=spf1 include:spf.protection.outlook.com include:spf.example-service.com -all
```

Only one SPF record is allowed per domain. If you already have one, edit it rather than adding a second.

## DKIM in Office 365: two CNAME records and a switch

DKIM (DomainKeys Identified Mail) signs each message so receivers can tell it really came from you. For DMARC to count it, the signature must use your own domain. Microsoft's own alignment table shows that a signature for `yourtenant.onmicrosoft.com` does not align with `example.com`, so you need to turn on DKIM for your custom domain.

### Step 1: Get your CNAME values

1. Open the Microsoft Defender portal at `https://security.microsoft.com/authentication`. The menu path is **Email & collaboration** > **Policies & rules** > **Threat policies** > **Email authentication settings**, then the **DKIM** tab.
2. Select your custom domain. The details flyout shows the two CNAME records to publish, with a **Copy** option.

The host names are the same for every Microsoft 365 organization: `selector1._domainkey` and `selector2._domainkey`. The values are unique to your tenant, so always copy them rather than typing them by hand. Depending on when the domain was added, the selector1 value for `example.com` has one of these two shapes:

```text
selector1-example-com._domainkey.<tenant>.<letter>-v1.dkim.mail.microsoft
selector1-example-com._domainkey.<tenant>.onmicrosoft.com
```

`<tenant>` is the first part of your `onmicrosoft.com` domain, and `<letter>` is a character Microsoft assigns, such as `r` or `n`. The first format is for custom domains added from May 2025 onwards. Existing domains keep the older `onmicrosoft.com` format.

### Step 2: Publish both CNAMEs at your DNS host

```text
Type:  CNAME
Host:  selector1._domainkey
Value: (selector1 value copied from Microsoft)

Type:  CNAME
Host:  selector2._domainkey
Value: (selector2 value copied from Microsoft)
```

### Step 3: Turn on signing

Back on the DKIM tab, open the domain again and turn on **Sign messages for this domain with DKIM signatures**. If the CNAMEs are not visible in DNS yet, Microsoft reports them as missing. Wait a little and try again. When it works, the status shows that the domain is signing with DKIM.

## DKIM troubleshooting

When the signing switch will not turn on, Microsoft has not found your CNAME records. On the **DKIM** tab, the domain's **Status** stays `CnameMissing` and the toggle stays **Disabled**. Microsoft says detection takes a few minutes or longer, so allow for that before you start looking for a mistake.

To see exactly what Microsoft expects, connect to Exchange Online PowerShell (Microsoft's steps are in the sources below) and run:

```text
Get-DkimSigningConfig | Format-List Name,Enabled,Status,Selector1CNAME,Selector2CNAME
```

It lists each domain with its DKIM status and the two CNAME targets Microsoft expects. Compare them with what your DNS host shows. The usual causes, from Microsoft's DKIM troubleshooting notes:

- **Your domain typed into the Name field.** Many DNS hosts, GoDaddy among them, add your domain to whatever you type. Enter `selector1._domainkey.example.com` and the record ends up at `selector1._domainkey.example.com.example.com`, where Microsoft never looks. Type only `selector1._domainkey` and `selector2._domainkey`.
- **A TXT record instead of a CNAME.** Microsoft 365 needs CNAMEs that point to its own DKIM servers. A pasted DKIM key in a TXT record leaves the status at `CnameMissing`. Delete the TXT record and add the CNAME.
- **A target typed by hand.** The target holds your domain with dashes instead of dots and your tenant prefix, and the newer format adds a letter Microsoft assigns. Copy it from the portal or from `Get-DkimSigningConfig`.
- **Only selector1.** Signing can switch on with one record, but Microsoft uses selector2 when it rotates keys, and rotation fails without it. Publish both.
- **Cloudflare proxy turned on.** A proxied CNAME answers with Cloudflare's addresses instead of Microsoft's target, so DKIM fails. Set both records to **DNS only**, as our Cloudflare guide shows under [proxy status](https://dmarcdone.com/guides/cloudflare#proxy-status-the-cloudflare-specific-trap).

## DMARC: one TXT record at _dmarc

DMARC (Domain-based Message Authentication, Reporting and Conformance) tells receivers what to do with mail that fails SPF and DKIM, and where to send reports. Start in monitoring mode:

```text
Type:  TXT
Host:  _dmarc
Value: v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com; fo=1
```

Microsoft notes that "The hostname value `_dmarc` is required." Replace `example.com` with your domain and create the `dmarc-reports@` address first. Microsoft recommends a dedicated mailbox or Microsoft 365 Group for reports rather than a person's inbox. If a checker still says [your domain has no DMARC record](https://dmarcdone.com/blog/no-dmarc-record-found) after you publish, check the host name first.

Microsoft 365 does not send DMARC failure reports, even when a `ruf=` address is published, so `fo=1` has no effect on mail to Microsoft. Other receivers may still send them if you add `ruf=` later.

Microsoft also recommends a DMARC record for your `onmicrosoft.com` domain if you do not send mail from it. In the Microsoft 365 admin center, go to **Settings** > **Domains**, select the `onmicrosoft.com` domain, open **DNS records**, select **Add record**, and add a TXT record named `_dmarc` with the value `v=DMARC1; p=reject`.

> **Plain-English takeaway:** For Microsoft 365, publish one SPF record ending in `-all`, two DKIM CNAMEs copied from the Defender portal (then flip the signing switch), and a DMARC record at `_dmarc` with `p=none` and a reporting address.

## Where to add the records

All four records go in your DNS host's control panel, not in Microsoft 365. The usual steps:

1. Sign in at your DNS host and open the DNS settings for your domain.
2. Add each record with the type, host and value above.
3. Save, then wait. Changes are often visible within minutes but can take longer.

The host name field is where panels differ, and the first item in the troubleshooting list above is what happens when a panel adds your domain for you. Our DNS host guides cover the details for [GoDaddy](https://dmarcdone.com/guides/godaddy), [Cloudflare](https://dmarcdone.com/guides/cloudflare), [IONOS](https://dmarcdone.com/guides/ionos), [STRATO](https://dmarcdone.com/guides/strato) and [Namecheap](https://dmarcdone.com/guides/namecheap).

## Common mistakes

- **Two SPF records.** Leftovers from an old email host are common. Two SPF records make SPF fail with a permanent error. Merge them into one.
- **Small SPF typos.** Microsoft lists the usual ones: a trailing dot after `outlook.com`, `include=` instead of `include:`, or a space after the colon.
- **Too many lookups.** Each `include:` costs DNS lookups and the limit is 10. See [how to fix too many SPF lookups](https://dmarcdone.com/blog/spf-too-many-dns-lookups).
- **CNAMEs published but signing left off.** Publishing the records is not enough. The switch in the Defender portal must be on.
- **Typed DKIM values.** One wrong character breaks DKIM. Copy the values.
- **Forgetting other senders.** Your website, CRM or marketing tool also needs SPF or DKIM with your domain before you enforce DMARC.

## Check your setup

Run the [free SPF, DKIM and DMARC check](https://dmarcdone.com/#check) on your domain once the records are in. It recognises Microsoft 365, looks up both DKIM selectors along with SPF and DMARC, and lists the exact records still missing.

## When to move to quarantine and reject

At `p=none` nothing is blocked, so anyone can still send as your domain, and security scanners report that as [DMARC policy not enabled](https://dmarcdone.com/blog/dmarc-policy-not-enabled). Microsoft's guidance is to start at `p=none`, move to `p=quarantine`, then to `p=reject`, checking the reports at each step. Our post on [DMARC quarantine vs reject](https://dmarcdone.com/blog/dmarc-quarantine-vs-reject) covers how long to wait and what to look for in them.

Reading the reports is the slow part, and it is the part our [managed DMARC rollout](https://dmarcdone.com/pricing) takes off your hands: we read them, account for every sender and take the domain to `p=reject` for you. If the domain is not at `p=reject` within 60 days, you get a full refund under our [refund conditions](https://dmarcdone.com/legal/refunds).

## Sources

- Microsoft Learn, Set up SPF to identify valid email sources for your Microsoft 365 domain: https://learn.microsoft.com/en-us/defender-office-365/email-authentication-spf-configure
- Microsoft Learn, How to use DKIM for email in your custom domain: https://learn.microsoft.com/en-us/defender-office-365/email-authentication-dkim-configure
- Microsoft Learn, Connect to Exchange Online PowerShell: https://learn.microsoft.com/en-us/powershell/exchange/connect-to-exchange-online-powershell
- Microsoft Learn, Set up DMARC to validate email in Microsoft 365: https://learn.microsoft.com/en-us/defender-office-365/email-authentication-dmarc-configure
- Microsoft Learn, Connect your domain by adding DNS records: https://learn.microsoft.com/en-us/microsoft-365/admin/get-help-with-domains/create-dns-records-at-any-dns-hosting-provider?view=o365-worldwide
