"Unable to / Cannot remove domain" error in Office 365

I decided to let my P1 account from the beta expire, and wanted to remove my vanity domain from the account.

I opened the admin interface, went into the domains section, selected my domain, and tried to remove it
Image(11)

However, I got the following error:
Image(12)

Fair enough, my public website was still using it. So I reset it to use the xyz.sharepoint.com domain, and tried again. The "Cannot remove domain" error disappeared, but the new one "Unable to remove domain" showed up now:
Image(13)

Again, understandable at first, as the login names and email addresses for my two accounts still used my vanity domain:
Image(14)

So, I updated both of them, tried again, but the error remained. I couldn’t find any reference to my vanity domain anywhere at all, but I read in the Office 365 community forums that it might still be associated with my Lync account. I found the final solution to fix it in the following thread:
http://community.office365.com/en-us/f/148/p/293/706.aspx (post by Mike_MSFT on 2011-May-12 4:42 PM).

Going to the Users overview in the Admin portal, you need to create a new view:
image

Enter a name, select the vanity domain that you want to remove, and click save:
image

Selecting the view you just created, you can then see all the users that are still associated with it:
image

As a last step, I deactivated the Lync license for each user, and reactivated it again afterwards.
image

Once I was done with all users, I was able to remove the domain successfully.

Post Media Link

Rene Modery

Having worked with SharePoint since 2007, Rene has been involved in and responsible for two Asia Pacific wide SharePoint implementations.Equipped with a Master’s degree in Information Systems and various relevant certifications, Rene keeps a keen interest in technology and how it can provide solutions to common problems, but also looks at the "business side of IT".He lives in Singapore with his wife and two cats. He has been awarded as a Office 365 MVP by Microsoft in April 2012