# DKIM

Review the Azure DNS queries recorded for finding SendGrid DKIM records and comparing coverage across schools. Each school's DKIM values must come from its own SendGrid account.

!!!warning Source-derived reference
These notes were recovered from OneNote. Configuration, permissions and operating results have not been freshly verified. Confirm the applicable authority and environment before acting.
!!!

## SEND GRID - DKIM

**NOTE:** THE SendGRID DKIM records are unique to each school, you cannot copy and paste the sendgrid dkim of one school into the DNS record of another school, it will not work. NOTE: Each school has their own SendGrid Account therefore each school has their own DKIM.

## SHOW ALL SENDGRID DKIM/domainkey RECORDS IN AZURE DNS

``` powershell
$allDNS = Get-XallSchoolDNSRecords
```

\$allDNS \| where {\$*.Name -like "*domainkey*"} \| select -exclude Id,ResourceGroupName,Etag,TargetResourceId \| sort ZoneName,Name \| where {\$*.Records -match "sendgrid" }  \| Format-Table

## FIND SCHOOLS MISSING SENDGRID DKIM: CHECK TO SEE IF A SCHOOLS IS MISSING THEIR SENDGRID DKIM ENTRY

\$compare = Compare-Object $(Get-XallSchoolInfo -includeCCMCO | select Domain).domain  $(\$allDNS \| where {\$*.Name -like "*domainkey*"} \| select -exclude Id,ResourceGroupName,Etag,TargetResourceId \| sort ZoneName,Name \| where {\$*.Records -match "sendgrid" } \| Select Zonename -Unique).ZoneName

if($($compare \| measure-object).count -gt 0){

if($($compare \| where {\$\_.SideIndicator -eq "\<="} \| measure-object).count -gt 0){

Write-Host "These schools are missing a DKIM record for SendGrid" -ForeGroundColor Yellow

$($compare \| where {\$\_.SideIndicator -eq "\<="}).InputObject \| out-host

}

if($($compare \| where {\$\_.SideIndicator -eq "=\>"} \| measure).count -gt 0){

Write-Host "These domains were missing from Get-XallSchoolInfo" -ForeGroundColor Cyan

$($compare \| where {\$\_.SideIndicator -eq "=\>"}).InputObject  \| out-host

}

}else{

Write-Host "A DKIM for SendGrid exists for all school domains" -ForegroundColor Green

}

M365 - DKIM

## Related guidance

- [Topic overview](Introduction.md)
- [Source review status](../../review/Review-status.md)
