You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: defender-office-365/email-authentication-dkim-configure.md
+38-37Lines changed: 38 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ f1.keywords:
5
5
ms.author: chrisda
6
6
author: chrisda
7
7
manager: deniseb
8
-
ms.date: 04/08/2024
8
+
ms.date: 04/14/2025
9
9
audience: ITPro
10
10
ms.topic: conceptual
11
11
@@ -32,7 +32,7 @@ appliesto:
32
32
33
33
DomainKeys Identified Mail (DKIM) is a method of [email authentication](email-authentication-about.md) that helps validate mail sent from your Microsoft 365 organization to prevent spoofed senders that are used in business email compromise (BEC), ransomware, and other phishing attacks.
34
34
35
-
The primary purpose of DKIM is to verify that a message hasn't been altered in transit. Specifically:
35
+
The primary purpose of DKIM is to verify that a message wasn't altered in transit. Specifically:
36
36
37
37
1. One or more private keys are generated for a domain and are used by the source email system to digitally sign important parts of outbound messages. These message parts include:
38
38
- From, To, Subject, MIME-Version, Content-Type, Date, and other message header fields (depending on the source email system).
@@ -59,11 +59,11 @@ Before we get started, here's what you need to know about DKIM in Microsoft 365
59
59
60
60
For more information about \*.onmicrosoft.com domains, see [Why do I have an "onmicrosoft.com" domain?](/microsoft-365/admin/setup/domains-faq#why-do-i-have-an--onmicrosoft-com--domain).
61
61
62
-
-**If you use one or more custom domains for email (for example, contoso.com)**: Even though all outbound mail from Microsoft 365 is automatically signed by the MOERA domain, you still have more work to do for maximum email protection:
62
+
-**If you use one or more custom domains for email (for example, contoso.com)**: Even though the MOERA domain signs all outbound mail from Microsoft 365, you still have more work to do for maximum email protection:
63
63
-**Configure DKIM signing using custom domains or subdomains**: A message needs to be DKIM signed by the domain in the From address. We also recommend configuring DMARC, and DKIM passes DMARC validation only if the domain that DKIM signed the message and the domain in the From address align.
64
64
65
65
-**Subdomain considerations**:
66
-
- For email services that aren't under your direct control (for example, bulk email services), we recommend using a subdomain (for example, marketing.contoso.com) instead of your main email domain (for example, contoso.com). You don't want issues with mail sent from those email services to affect the reputation of mail sent by employees in your main email domain. For more information about adding subdomains, see [Can I add custom subdomains or multiple domains to Microsoft 365?](/microsoft-365/admin/setup/domains-faq#can-i-add-custom-subdomains-or-multiple-domains-to-microsoft-365).
66
+
- For email services that aren't under your direct control (for example, bulk email services), we recommend using a subdomain (for example, marketing.contoso.com) instead of your main email domain (for example, contoso.com). You don't want issues with mail sent from those email services to affect the reputation of mail sent by users in your main email domain. For more information about adding subdomains, see [Can I add custom subdomains or multiple domains to Microsoft 365?](/microsoft-365/admin/setup/domains-faq#can-i-add-custom-subdomains-or-multiple-domains-to-microsoft-365).
67
67
- Each subdomain that you use to send email from Microsoft 365 requires its own DKIM configuration.
68
68
69
69
> [!TIP]
@@ -78,61 +78,63 @@ The rest of this article describes the DKIM CNAME records that you need to creat
78
78
> [!TIP]
79
79
> Configuring DKIM signing using a custom domain is a mixture of procedures in Microsoft 365 and procedures at the domain registrar of the custom domain.
80
80
>
81
-
> We provide instructions to create CNAME records for different Microsoft 365 services at many domain registrars. You can use these instructions as a starting point to create the create the DKIM CNAME records. For more information, see [Add DNS records to connect your domain](/Microsoft-365/admin/get-help-with-domains/create-dns-records-at-any-dns-hosting-provider).
81
+
> We provide instructions to create CNAME records for different Microsoft 365 services at many domain registrars. You can use these instructions as a starting point to create the DKIM CNAME records. For more information, see [Add DNS records to connect your domain](/Microsoft-365/admin/get-help-with-domains/create-dns-records-at-any-dns-hosting-provider).
82
82
>
83
83
> If you're unfamiliar with DNS configuration, contact your domain registrar and ask for help.
84
84
85
85
## Syntax for DKIM CNAME records
86
86
87
-
> [!TIP]
88
-
> You use the Defender portal or Exchange Online PowerShell to view the required CNAME values for DKIM signing of outbound messages using a custom domain. The values presented here are for illustration only. To get the values that are required for your custom domains or subdomains, use the procedures later in this article.
89
-
90
87
DKIM is exhaustively described in [RFC 6376](https://datatracker.ietf.org/doc/html/rfc6376).
91
88
89
+
In Microsoft 365, two public-private key pairs are generated when DKIM signing using a custom domain or subdomain is enabled. The private keys that are used to sign the message are inaccessible. The CNAME records point to the corresponding public keys that are used to verify the DKIM signature. These records are known as _selectors_.
90
+
91
+
- Only one selector is active and used when DKIM signing using a custom domain is enabled.
92
+
- The other selector is inactive. It's activated and used only after any future [DKIM key rotation](#rotate-dkim-keys), and then only after the original selector is deactivated.
93
+
94
+
The selector that's used to verify the DKIM signature (which infers the private key that was used to sign the message) is stored in the **s=** value in the **DKIM-Signature** header field (for example, `s=selector1-contoso-com`).
95
+
96
+
> [!IMPORTANT]
97
+
> Use the Defender portal or Exchange Online PowerShell to view the required CNAME values for DKIM signing of outbound messages using a custom domain. The values presented here are for illustration only. To get the required values for your custom domains or subdomains, use the procedures later in this article.
98
+
92
99
The basic syntax of the DKIM CNAME records for custom domains that send mail from Microsoft 365 is:
93
100
94
101
```text
95
102
Hostname: selector1._domainkey
96
-
Points to address or value: selector1-<CustomDomain>._domainkey.<InitialDomainPrefix>.n-v1.dkim.mail.microsoft
103
+
Points to address or value: selector1-<CustomDomainWithDashes>._domainkey.<InitialDomainPrefix>.<DynamicPartitionCharacter>-v1.dkim.mail.microsoft
97
104
98
105
Hostname: selector2._domainkey
99
-
Points to address or value: selector2-<CustomDomain>._domainkey.<InitialDomainPrefix>.n-v2.dkim.mail.microsoft
106
+
Points to address or value: selector2-<CustomDomainWithDashes>._domainkey.<InitialDomainPrefix>.<DynamicPartitionCharacter>-v1.dkim.mail.microsoft
100
107
```
101
108
102
-
- In Microsoft 365, two public-private key pairs are generated when DKIM signing using a custom domain or subdomain is enabled. The private keys that are used to sign the message are inaccessible. The CNAME records point to the corresponding public keys that are used to verify the DKIM signature. These records are known as _selectors_.
103
-
- Only one selector is active and used when DKIM signing using a custom domain is enabled.
104
-
- The second selector is inactive. It's activated and used only after any future [DKIM key rotation](#rotate-dkim-keys), and then only after the original selector is deactivated.
105
-
106
-
The selector that's used to verify the DKIM signature (which infers the private key that was used to sign the message) is stored in the **s=** value in the **DKIM-Signature** header field (for example, `s=selector1-contoso-com`).
107
-
108
109
-**Hostname**: The values are the same for all Microsoft 365 organizations: `selector1._domainkey` and `selector2._domainkey`.
109
-
110
-
-**\<CustomDomain\>**: The custom domain or subdomain with periods replaced by dashes. For example, `contoso.com` becomes `contoso-com`, or `marketing.contoso.com` becomes `marketing-contoso-com`.
111
-
110
+
-**\<CustomDomainWithDashes\>**: The custom domain or subdomain with periods replaced by dashes. For example, `contoso.com` becomes `contoso-com`, or `marketing.contoso.com` becomes `marketing-contoso-com`.
112
111
-**\<InitialDomainPrefix\>**: The custom part of the \*.onmicrosoft.com you used to enroll in Microsoft 365. For example, if you used `contoso.onmicrosoft.com`, the value is `contoso`.
112
+
-**\<DynamicPartitionCharacter\>**: A dynamically generated character that's used for both selectors.
113
+
-**v1**: The current CNAME format version that's used for both selectors.
114
+
-**dkim.mail.microsoft**: The parent DNS zone that's the same for both selectors.
113
115
114
116
For example, your organization has the following domains in Microsoft 365:
-**Custom domains**: cohovineyard.com and cohowinery.com
118
120
119
-
You need to create two CNAME records in each custom domain, for a total of four CNAME records:
121
+
You need to create two CNAME records in DNS in each custom domain, for a total of four CNAME records:
120
122
121
123
-**CNAME records in the cohovineyard.com domain**:
122
124
123
125
**Hostname**: `selector1._domainkey`<br>
124
126
**Points to address or value**: `selector1-cohovineyard-com._domainkey.cohovineyardandwinery.n-v1.dkim.mail.microsoft`
125
127
126
128
**Hostname**: `selector2._domainkey`<br>
127
-
**Points to address or value**: `selector2-cohovineyard-com._domainkey.cohovineyardandwinery.n-v2.dkim.mail.microsoft`
129
+
**Points to address or value**: `selector2-cohovineyard-com._domainkey.cohovineyardandwinery.n-v1.dkim.mail.microsoft`
128
130
129
131
-**CNAME records in the cohowinery.com domain**:
130
132
131
133
**Hostname**: `selector1._domainkey`<br>
132
-
**Points to address or value**: `selector1-cohowinery-com._domainkey.cohovineyardandwinery.n-v1.dkim.mail.microsoft`
134
+
**Points to address or value**: `selector1-cohowinery-com._domainkey.cohovineyardandwinery.r-v1.dkim.mail.microsoft`
133
135
134
136
**Hostname**: `selector2._domainkey`<br>
135
-
**Points to address or value**: `selector2-cohowinery-com._domainkey.cohovineyardandwinery.n-v2.dkim.mail.microsoft`
137
+
**Points to address or value**: `selector2-cohowinery-com._domainkey.cohovineyardandwinery.r-v1.dkim.mail.microsoft`
136
138
137
139
## Configure DKIM signing of outbound messages in Microsoft 365
138
140
@@ -141,7 +143,7 @@ You need to create two CNAME records in each custom domain, for a total of four
141
143
> [!TIP]
142
144
> Enabling DKIM signing of outbound messages using a custom domain effectively switches DKIM signing from using the initial \*.onmicrosoft.com domain to using the custom domain.
143
145
>
144
-
> You can use a custom domain or subdomain to DKIM sign outbound mail only after the domain has been successfully added to Microsoft 365. For instructions, see [Add a domain](/microsoft-365/admin/setup/add-domain#add-a-domain).
146
+
> You can use a custom domain or subdomain to DKIM sign outbound mail only after the domain is successfully added to Microsoft 365. For instructions, see [Add a domain](/microsoft-365/admin/setup/add-domain#add-a-domain).
145
147
>
146
148
> The main factor that determines when a custom domain starts DKIM signing outbound mail is the CNAME record detection in DNS.
147
149
@@ -175,27 +177,27 @@ Proceed if the domain satisfies these requirements.
175
177
|Microsoft.Exchange.ManagementTasks.ValidationException|CNAME record does not
176
178
exist for this config. Please publish the following two CNAME records first. Domain Name
177
179
: contoso.com Host Name : selector1._domainkey Points to address or value: selector1-
178
-
contoso-com._domainkey.contoso.onmicrosoft.com Host Name : selector2._domainkey
179
-
Points to address or value: selector2-contoso-com._domainkey.contoso.onmicrosoft.com .
180
+
contoso-com._domainkey.contoso.n-v1.dkim.mail.microsoft.com Host Name : selector2._domainkey
181
+
Points to address or value: selector2-contoso-com._domainkey.contoso.n-v1.dkim.mail.microsoft .
180
182
If you have already published the CNAME records, sync will take a few minutes to as
181
183
many as 4 days based on your specific DNS. Return and retry this step later.
182
184
```
183
185
184
186
Therefore, the CNAME records that you need to create in DNS for the contoso.com domain are:
185
187
186
188
**Hostname**: `selector1._domainkey`<br>
187
-
**Points to address or value**: `selector1-contoso-com._domainkey.contoso.onmicrosoft.com`
189
+
**Points to address or value**: `selector1-contoso-com._domainkey.contoso.n-v1.dkim.mail.microsoft`
188
190
189
191
**Hostname**: `selector2._domainkey`<br>
190
-
**Points to address or value**: `selector2-contoso-com._domainkey.contoso.onmicrosoft.com`
192
+
**Points to address or value**: `selector2-contoso-com._domainkey.contoso.n-v1.dkim.mail.microsoft`
191
193
192
194
Copy the information from the error dialog (select the text and press CTRL+C), and then select **OK**.
193
195
194
196
Leave the domain details flyout open.
195
197
196
198
6. In another browser tab or window, go to the domain registrar for the domain, and then create the two CNAME records using the information from the previous step.
197
199
198
-
We provide instructions to create CNAME records for different Microsoft 365 services at many domain registrars. You can use these instructions as a starting point to create the DKIM CNAME records. For more information, see [Add DNS records to connect your domain](/Microsoft-365/admin/get-help-with-domains/create-dns-records-at-any-dns-hosting-provider).
200
+
We provide instructions to create CNAME records for different Microsoft 365 services at many domain registrars. You can use these instructions as a starting point to create the DKIM CNAME records. For more information, see [Add DNS records to connect your domain](/Microsoft-365/admin/get-help-with-domains/create-dns-records-at-any-dns-hosting-provider).
199
201
200
202
It takes a few minutes (or possibly longer) for Microsoft 365 to detect the new CNAME records that you created.
201
203
@@ -266,7 +268,7 @@ If you'd rather use PowerShell to enable DKIM signing of outbound messages using
266
268
> [!TIP]
267
269
> Before you can configure DKIM signing using the custom domain, you need to add the domain to Microsoft 365. For instructions, see [Add a domain](/microsoft-365/admin/setup/add-domain#add-a-domain). To confirm that the custom domain is available for DKIM configuration, run the following command: `Get-AcceptedDomain`.
268
270
>
269
-
> As described earlier in this article, your \*.onmicrosoft.com domain is already signing outbound email by default. Typically, unless you've manually configured DKIM signing for the \*.onmicrosoft.com domain in the Defender portal or in PowerShell, the \*.onmicrosoft.com doesn't appear in the output of **Get-DkimSigningConfig**.
271
+
> As described earlier in this article, your \*.onmicrosoft.com domain is already signing outbound email by default. Typically, unless you manually configured DKIM signing for the \*.onmicrosoft.com domain in the Defender portal or in PowerShell, the \*.onmicrosoft.com doesn't appear in the output of **Get-DkimSigningConfig**.
270
272
271
273
1. Run the following command to verify the availability and DKIM status of all domains in the organization:
272
274
@@ -302,7 +304,6 @@ If you'd rather use PowerShell to enable DKIM signing of outbound messages using
302
304
- 1024 (default)
303
305
- 2048
304
306
305
-
306
307
For example:
307
308
308
309
```powershell
@@ -328,10 +329,10 @@ If you'd rather use PowerShell to enable DKIM signing of outbound messages using
328
329
For example:
329
330
330
331
**Hostname**: `selector1._domainkey`<br>
331
-
**Points to address or value**: `selector1-contoso-com._domainkey.contoso.onmicrosoft.com`
332
+
**Points to address or value**: `selector1-contoso-com._domainkey.contoso.n-v1.dkim.mail.microsoft`
332
333
333
334
**Hostname**: `selector2._domainkey`<br>
334
-
**Points to address or value**: `selector2-contoso-com._domainkey.contoso.onmicrosoft.com`
335
+
**Points to address or value**: `selector2-contoso-com._domainkey.contoso.n-v1.dkim.mail.microsoft`
335
336
336
337
4. Do one of the following steps:
337
338
@@ -434,7 +435,7 @@ To confirm the corresponding public key that's used to verify the DKIM signature
434
435
435
436
6. After four days (96 hours), the new DKIM key begins to sign outbound messages for the custom domain. Until then, the current DKIM key is used.
436
437
437
-
You can tell when the new DKIM key is being used when the **Status** value changes from **Rotating keys for this domain and signing DKIM signatures** to **Signing DKIM signatures for this domain**.
438
+
The new DKIM key is being used to sign message when the **Status** value changes from **Rotating keys for this domain and signing DKIM signatures** to **Signing DKIM signatures for this domain**.
438
439
439
440
To confirm the corresponding public key that's used to verify the DKIM signature (which infers the private key that was used to sign the message), check the **s=** value in the **DKIM-Signature** header field (the selector; for example, `s=selector1-contoso-com`).
440
441
@@ -574,7 +575,7 @@ Use any of the following methods to verify DKIM signing of outbound email from M
574
575
> The DKIM signature is omitted under either of the following conditions:
575
576
>
576
577
> - The sender and recipient email addresses are in the same domain.
577
-
> - The sender and recipient email addresses are in different domains that are controlled by the same organization.
578
+
> - The sender and recipient email addresses are in different domains controlled by the same organization.
578
579
>
579
580
> In both cases, the **DKIM-Signature** header field doesn't exist in the message header, and the **Authentication-Results** header field looks like the following example:
580
581
>
@@ -618,7 +619,7 @@ In this example, the following steps are required:
618
619
4. If the destination email system checks DKIM on inbound messages, the messages pass DKIM because they're DKIM signed.
619
620
5. If the destination email system checks DMARC on inbound messages, the domain in the DKIM signature (the **d=** value in the **DKIM-Signature** header field) matches the domain in the From address that's shown in email clients, so the messages can also pass DMARC:
@@ -631,4 +632,4 @@ As described in [How SPF, DKIM, and DMARC work together to authenticate email me
631
632
For mail coming _into_ Microsoft 365, you might also need to configure trusted ARC sealers if you use services that modify messages in transit before delivery to your organization. For more information, see [Configure trusted ARC sealers](email-authentication-arc-configure.md).
632
633
633
634
> [!TIP]
634
-
> Exchange 2016 and Exchange 2019 are known to modify messages that flow through them, which can impact DKIM.
635
+
> Exchange 2016 and Exchange 2019 are known to modify messages that flow through them, which can affect DKIM.
0 commit comments