How to enable DKIM for custom domains through Office 365?

Domain Keys Identified Mail (DKIM) is an advanced security feature which is mainly used to prevent cyber-attacks on the domains. This article explains how to set up DKIM feature for your domain through Office 365.

Enable DKIM for your domain

  • On your local computer, click on the search box on the taskbar and type PowerShell.
  • On the command window, run the following command: $UserCredential = Get-Credential
  • A Windows PowerShell credential window opens.
  • Enter your username and password in the text area.
  • Click on OK to confirm.

See Screenshot:

  • On the PowerShell Administrator command window, run the following command: $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

See Screenshot:

  • To access the tenant, run the following command: Import-PSSession $Session -DisableNameChecking

See Screenshot:

For custom domains, you need to publish CNAME records. To do this:

  • Generate the New Key for your domain [example.com] to have the CNAME.
  • Run the command: New-DkimSigningConfig -DomainName example.com -KeySize 2048 -Enabled $true

See Screenshot:

  • Collect the CNAME by running the command: Get-DkimSigningConfig -Identity example.com | Format-List Selector1CNAME, Selector2CNAME

See Screenshot:

  • After creating and updating the CNAME at your DNS, you need to enable it via below command or over the portal.

Example of CNAME:

Host name:            selector1. _domainkey

Points to address or value: [ as available in shell]

Host name:            selector2._domainkey

Points to address or value: [ as available in shell]

 

  • To enable the DKIM, you need to run the command: Set-DkimSigningConfig -Identity example.com -Enabled $true.

 

See Screenshot:

  • To verify DKIM, you need to run the command: Get-DkimSigningConfig -Identity example.com | Format-List

Ask a question

"Hey couldn't find what you were looking for in our knowledgebase? Please enter your question here".

First Name *
Last Name *
Email Address *
Question *
Captcha *