1. Home
  2. Training Library
  3. Microsoft Azure
  4. Courses
  5. Setting Up and Managing a Microsoft 365 Tenant

Adding Domains in Bulk through PowerShell

The course is part of this learning path

Contents

keyboard_tab
play-arrow
Start course
Overview
DifficultyBeginner
Duration1h 44m
Students71
Ratings
5/5
star star star star star

Description

Microsoft 365 represents a combination of Office 365, Windows 10 and Enterprise Mobility offerings – providing the most complete set of SaaS technologies that Microsoft has to offer. With Microsoft 365, organizations can deploy a complete solution encompassing both devices and applications, along with applying security and compliance policies to protect the entire suite.

This course will help you as you plan your deployment of Microsoft 365, along with configuring and managing your tenant once it’s deployed. It also covers setting up and managing a Microsoft 365 subscription for an enterprise – including managing identities, security, compliance and the supporting technologies in the Microsoft 365 stack.

This course focuses mainly on setting up and managing a Microsoft 365 tenant – including the process for setting up a trial tenant, adding your own domains, and converting your tenant beyond the trial to a fully functional production environment. Now, these steps can seem to be very easy – just click a few options, answer a few questions, and you’re done. In fact, it is that easy! However, if you’re not aware of the big picture and asking some important questions along the way, you can end up painting yourself into a corner and causing problems down the road. At best, you might need to redo some things, at worst, you leave yourself with problems on your hands that might be difficult to sort out later.

After you’re set up, we’ll move on to talking about some of the things you need to consider in your day to day monitoring and management of your Microsoft 365 Tenant and the services that make it up. We’re also going to run through a few demos – showing you some of the practical steps involved, along with some tips and tricks we’ve picked up along the way.

 Learning Objectives

  • Set up a new Microsoft 365 tenant and subscription
  • Add domains to the tenant and configure them for the various service offerings
  • Perform the day to day management of your users, including managing user accounts and license assignment
  • Know how to monitor the various services in your M365 tenant and have a plan in place to respond to service alerts and manage service requests

 Intended Audience

This course is intended for people who:

  • Want to become a Microsoft 365 administrator
  • Are preparing to take the Microsoft’s MS-100 exam

Prerequisites

To get the most from this course, you should have a general understanding of networking & server administration as well as IT fundamentals such as DNS, Active Directory and PowerShell.

Transcript

Let's move on to adding or managing your domains through PowerShell. 

Adding domains through the GUI is probably gonna be your easiest approach, especially when you only have a few domains to add, however, if you need to add or manage multiple domains, then PowerShell is the way to go. You can add up to 900 domains in Office 365, which would be absolutely brutal to do through the GUI. 

To add multiple domains through PowerShell, start by creating a simple CSV or TXT file with a list of your domains. When creating a simple TXT file like this, it's not necessary to give your column a header, but I like to do that as it makes it easier to target each line later. In order to do these steps, you're going to need to make sure that you've installed the Microsoft Online PowerShell Modules and connected to Office 365. We'll start by creating a variable called domains, and then importing our CSV file into it like so. 

As before, you can check to make sure that your variable shows what you want just by recalling it. Okay, it looks good, we have our main domain, and then just two dummy domains we're gonna add. Next step from here is we're gonna connect to the MsolService. Let's go ahead and do that. Okay, now we're connected, we can do Get-MsolDomain. See that we just have the one available to us. Okay, so now we're gonna do a foreach line, like so, and again, like before, we're gonna say each line in our domain, so one, two, three, for each D in domains, I'm gonna do -MsolDomain, Authentication is Managed, and then the Name is d.Domain, and then when we're done, we're gonna get the MsolDomainverificationDns, and we're gonna export the DnsTxtRecord into a CSV file, that'll allow us to go back and add these records to our DNS provider as normal. 

Okay, so I'm just gonna run this now. Now, we can see that all three domains have been added, and if we check the file that was exported, we have the following. Okay, so I'm just gonna take this one here because this is one that's for my real domain, and we're gonna go back into GoDaddy, and we're gonna add the TXT record like we always have before. Again, it's @, TXT Value, time to deliver is one hour, click Save, and we're ready to go. Now you can come back and you can verify your domains using this next foreach command. Now remember that only one of these three domains is gonna come back as verified because the other two are dummy domains, we're not expecting them to come back as verified. So let's go ahead and run this now and see what happens. Okay, so the two other domains, as expected, failed because there's nothing ready for them, but the first one did. If we go back now and check our domains by doing get-MsolDomain, we can see that m365jedi.com has been verified and managed, and is now ready to go. My third domain and my second domain are not verified as expected, so let's go and look at them in the portal. Continue setup. Domain verification has been completed, and now we're ready set up online services as before. 

So we're gonna Save and close here, and in this case, now we can go ahead and make this our default domain if we want to. Close it down, and these two domains, we'll just delete because we're not going to use them.

About the Author

Jeremy Dahl is a Senior Technology Consultant who has spent the last 8 years focusing on Microsoft 365 technologies and has been an Office 365 MVP for the last 6 years. Jeremy is a self-proclaimed cloud addict who architects technology solutions that combine cloud technologies with on-premises solutions, allowing organizations to make the most of their existing infrastructure while still taking full advantage of the agility and scalability of what the cloud has to offer.

Jeremy can be found blogging about Microsoft 365 technologies on his website, masterandcmdr.com, and evangelizing the Microsoft cloud on Twitter.

Covered Topics