Monday, December 15, 2014

Removing a Domain from Office 365 – What to check for

To remove a domain from Office 365, make sure that no settings are using the domain. You will not be able to remove the domain if one or more of the following conditions are true:
  1. User accounts or groups are associated with the domain;
  2. The proxies that correspond to the domain for all mail-licensed users and for all mail-enabled groups are not removed. Office 365 blocks the deletion of a domain until the proxies that correspond to the domain are removed;
  3. Lync Online Session Initiation Protocol addresses are used by the domain.
 
This is mostly common knowledge and what I usually check for when removing a domain. However, the last time I did this in one of my test tenants, I just wasn’t being able to remove it...
 
Initially I used the GUI:
 
 
But it always got stuck in this window no matter how long I waited for:
 
 
So I decided to do it from the Shell. After connecting to Office 365 I tried using the Remove-MsolDomain cmdlet with not much success:
 
 
So I checked for users associated with the domain I was trying to remove and there were none. By I forgot I had created contacts before, so I checked for any Exchange Online object that contained at least one email address that matched the domain, and voila!
 
 
Ok, certainly now it had to work, right? Not really...
 
 
Another inspiration and I remembered I had created an outbound connector for this domain to test Exchange Online Protection Conditional Mail Routing! And here it was:
 
 
 
So I removed it using the Shell and finally I was able to remove the domain!
 
 
 
Bottom line is, check everything! Including:
  • Whether user names contain the domain name: Get-MsolUser -DomainName “yourdomain.com”;
  • All recipients’ email addresses: Get-Recipient | Where {$_.EmailAddresses -match “yourdomain.com”};
  • Transport Rules;
  • Connectors;
  • Your public website hosted on Office 365.

No comments:

Post a Comment