To start routing email through Microsoft 365 you need to configure the DNS properly, you can refer to Microsoft 365 admin page.
In the Microsoft 365 admin center, go to Settings and Domains.
Select your domain, Choose Manage DNS, then select More Options > Add your own DNS.
You’ll see the DNS records to add.
Generally speaking here is the standard configuration:
service | type | Host Name | Value | Priority | TTL |
Microsoft Exchange | MX | @ | domain-ext.mail.protection.outlook.com | 0 | 3600 |
Microsoft Exchange | TXT | @ | v=spf1 include:spf.protection.outlook.com -all | - | 3600 |
Microsoft Exchange | CNAME | autodiscover | autodiscover.outlook.com | - | 3600 |