Three records let Exchange Online receive the school's mail, stop other people sending as you, and let Outlook set itself up.
School email is delivered, and others cannot send as you.
Without these records mail goes nowhere, or forged mail passes as genuine.
Add the MX, SPF and autodiscover records, then turn on DKIM and DMARC.
Every name, address and value in this guide is an example. Replace them with your own.
Get the exact MX value
A domain with DNSSEC turned on gets a different mail address, ending mx.microsoft, so copy yours. The admin centre shows it under Settings › Domains › contoso.com › DNS records, or ask Microsoft Graph:
Install-Module Microsoft.Graph.Identity.DirectoryManagement -Scope CurrentUser
Connect-MgGraph -TenantId contoso.onmicrosoft.com -Scopes "Domain.Read.All" -NoWelcome
Get-MgDomainServiceConfigurationRecord -DomainId "contoso.com" |
Where-Object RecordType -eq "Mx" | ForEach-Object { $_.AdditionalProperties.mailExchange }When Windows asks you to sign in, untick Allow my organization to manage my device and choose No, sign in to this app only. Otherwise your PC registers itself with the school's tenant.
Add the records
| Type | Name | Value | For |
|---|---|---|---|
| MX | @ | contoso-com.mail.protection.outlook.com, priority 0 | Receiving email |
| TXT | @ | v=spf1 include:spf.protection.outlook.com -all | SPF: who may send as you |
| CNAME | autodiscover | autodiscover.outlook.com | Outlook setup |
Use your own MX value from step 1. If the school sends mail from another service, such as an MIS or newsletter tool, add it to the SPF record before -all. A domain can have only one SPF record.
If the domain is in Azure DNS:
$rg = "rg-contoso-dns"; $z = "contoso.com" az network dns record-set mx add-record -g $rg -z $z -n "@" -e "contoso-com.mail.protection.outlook.com" -p 0 az network dns record-set txt add-record -g $rg -z $z -n "@" -v "v=spf1 include:spf.protection.outlook.com -all" az network dns record-set cname set-record -g $rg -z $z -n autodiscover -c autodiscover.outlook.com
Type the real value between the quotes. A leftover <MX-TARGET> fails with "The system cannot find the file specified", because Windows reads < as "read from a file".
Done when
Resolve-DnsName contoso.com -Type MX -Server 8.8.8.8 returns your Microsoft 365 address, and the admin centre shows the Exchange records as OK.


