Configure DNS and SPF for an Exchange Hybrid Deployment
Question details
Configure SPF and Autodiscover DNS for a hybrid Exchange deployment with on-premises and Microsoft 365 mailboxes.

- Product
- Microsoft Exchange Server and Microsoft 365
- Device & OS
- not provided
- Scenario
- An organization uses both on-premises Exchange and Microsoft 365 and needs DNS settings suited to its hybrid mail flow.
- Observed behavior
- SPF should authorize legitimate outbound mail sources, while Autodiscover should direct users according to the hybrid topology.
Identify your authoritative DNS provider, the public IP addresses used for on-premises outbound mail, and any other services that send mail for the domain. Check the existing SPF and Autodiscover records and confirm your hybrid mail-flow design before changing them.
Configure SPF and check Autodiscover for Exchange hybrid
Use this approach to authorize outbound senders and preserve the Autodiscover endpoint required by your hybrid design.
In your DNS provider's management console, find the domain's TXT records and the record for autodiscover.yourdomain.com. Note any existing SPF record and the current Autodiscover target.
Edit the existing SPF TXT record for the sending domain so it includes every legitimate outbound source. For example, use v=spf1 ip4:SERVER-IP include:spf.protection.outlook.com -all, replacing SERVER-IP with the public IP used by an on-premises outbound server. Add an ip4 mechanism for each additional authorized IPv4 address and include any other legitimate sending services.
In the DNS console, keep Autodiscover directed to the on-premises environment unless your documented hybrid design requires a different configuration. Review cloud-only Microsoft 365 setup instructions against your topology before changing this record.
After DNS changes propagate, query the domain's TXT records with nslookup -type=TXT yourdomain.com and check the Autodiscover record with nslookup autodiscover.yourdomain.com. Use Microsoft Remote Connectivity Analyzer to test Outlook Autodiscover connectivity.

Use WPS Office for everyday document and spreadsheet work
WPS Office is a free, lightweight alternative for working with documents, spreadsheets, and presentations. Its familiar interface and Microsoft Office format compatibility make migration straightforward. It does not configure Exchange DNS or replace Exchange mail services.

Frequently Asked Questions
Can I add multiple on-premises server IP addresses to SPF?
Yes. In the domain's SPF TXT record, add a separate ip4: mechanism for each authorized public IPv4 address. Keep the Microsoft 365 include and any other legitimate senders in the same SPF record.
Should I create a separate SPF record for Microsoft 365?
No. A sending domain or subdomain should have one SPF record. Add include:spf.protection.outlook.com to the existing record along with the other authorized mail sources.
Should Autodiscover point to Microsoft 365 in a hybrid deployment?
In a typical hybrid deployment, keep Autodiscover directed to the on-premises environment unless your hybrid design specifies otherwise. Check the existing DNS target and topology before following cloud-only setup instructions.
What happens if I use -all before listing every sender?
Mail from an unlisted source can fail SPF, which may affect delivery depending on the recipient's checks. Review all outbound services in your SPF TXT record before using -all; consider ~all while monitoring a transition.




