Have any questions

Get DKIM/DMARC/SPF records for Microsoft CSP client’s tenants

Microsoft’s Cloud Solution Provider (CSP) uses a CSP portal to access clients’ tenants. This script will fetch the tenant IDs through the CSP credentials. Then it will extract details of all the verified domains within each tenant. Lastly, it will check DKIM, DMARC and SPF txt record details of the tenant’s verified domains and create a get_result.txt file that contains all the details within the same folder.


$ErrorActionPreference= ‘silentlycontinue’
Install-Module PartnerCenter
Install-Module MSOnline
Install-Module AzureAD

$tenant = Get-MsolPartnerContract -All | Select-Object TenantId
‘there are ‘ + $tenant.Count + ‘ tenant’
$d = 0

$Result = foreach ($ids in $tenant.TenantId) {

Download Full Script

The .txt file will display record names as below:

DKIM Selector 1 CNAME Record

DKIM Selector 2 CNAME Record


SPF TXT Record

Purpose:The purpose of this script is to check whether DKIM/DMARC/SPF records are created for each of the tenant's verified domains
Type:PowerShell Script (ps1)
Reference link:

Quickly Check and Manage your Exchange Online DNS Records for SPF, DKIM and DMARC with PowerShell