How To: Set up domains in bulk in Office 365 Tenant

When preparing clients for moving to Office 365 you often run across a scenario where they have many domains to add and verify in the tenant. The process for verifying ownership can be long and annoying for lots of domains if you are getting the detail manually, however, the following two PowerShell commands can help save you time!

office_365_dns

 

Firstly, create a CSV with all of your domains, and add them to the tenant with the following command (where there is one column in your CSV called DomainName:

Import-CSV <Path to your CSV File> | Foreach{New-MsolDomain -Name $_.DomainName}

This will add all of your required domains to the tenant. You can then retrieve all of the required TXT records to validate ownership with the following command:

Get-MsolDomain -Status unverified | Foreach{Get-MsolDomainVerificationDns -DomainName $_.Name -Mode DNSTxtRecord}

And finally, once you have added these DNS records for your domains you can validate them using the following command:

Get-MsolDomain -Status unverified | Foreach{Confirm-MsolDomain -DomainName $_.Name}

So long as the DNS record has been added and propagated you should have all of your domains verified in the tenant!

If you have any questions or comments please either use the comments section below, Tweet me @MikeParker365 or via email blog@mikeparker365.co.uk.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s