O365 – DKIM signing

how to sign O365-Mails using DKIM

Set-ExecutionPolicy RemoteSigned 
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Install-PackageProvider -Name NuGet

Install-Module -Name ExchangeOnlineManagement
Update-Module -Name ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement
$o365Cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $o365Cred -Authentication Basic -AllowRedirection
Set-ExecutionPolicy RemoteSigned
Import-PSSession $Session
Enable-OrganizationCustomization
New-ManagementRoleAssignment -Role "Mailbox Import Export" -SecurityGroup "Organization Management"
Remove-PSSession $session
Disconnect-ExchangeOnline

# DKIM
New-DkimSigningConfig -DomainName FQDN -Enabled $false
Get-DkimSigningConfig -Identity FQDN | Format-List Selector1CNAME, Selector2CNAME

# Grab the CNAMES and update them in DNS.
# Then run the command:
Set-DkimSigningConfig -Identity FQDN -Enabled $true

Leave a Reply

Your email address will not be published. Required fields are marked *