Today I created a new WordPress website. And I bind my domain to Office 365, so that I can use the domain name as my email alias.
Firstly, I updated wp-config.php to pick up the new domain name.
define('WP_SITEURL', 'http://DOMAIN'); define('WP_HOME', 'http://DOMAIN');
And then I changed the A record from my domain provider. Inside of the DNS setting, I have below two records:
Type Host name Points to address or value TTL A @ x.x.x.x 1 Hour A www x.x.x.x 1 Hour
And my domain already works in Office 365. However, my website still cannot resolve. For troubleshooting, firstly, I tried to add A record into my /etc/hosts. and it resolves my Domain name fine. So it confirms this is a DNS issue. I went to the DNS aggregation check and everything goes fine. I even did ping to the website, and it resolve fine.
So what exactly the issue is? I was stuck for a couple of hours.
Finally, I remember in Office 365, there is DNS management step during the setup. I went to Office 365 admin center > DNS management setting. And I found there is a DNS entry missing. So I add that missing entry, everything starts to work.
Conclusion, when you use Office 365 and add the DNS record inside of 365. You have to make sure all the records are correct and up to date. Because as soon as you add your dns information to Office 365. It looks like Microsoft will be take care of your dns.