Skip Ribbon Commands
Skip to main content
 

 Follow Me

 
 
 
 
 

 SharePoint Blog List

 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
Todd Klindt's home page > Todd Klindt's SharePoint Admin Blog
What's going on with TK.
January 17
How to Add a Domain to Office 365 and Azure using PowerShell

I love blog posts like this. PowerShell and Office 365, two of my favorite tastes, all rolled up into one. This particular blog post is not groundbreaking, but it’s fun. I’ve recently set up a few Office 365 tenants, and part of that is adding one or more custom domains. Of course you can use the Office 365 Admin Portal to do that, and there’s no shame in that. (Well, maybe a little) But if you want to take your Office 365 Admin game up another level, you can do all of that with PowerShell. I’ll show you how in this blog post.

Getting the Module and the Domain

You need to make sure you have the correct Azure PowerShell module installed before you can take advantage of any of the goodness in this blog post. When I wrote this blog post, I was using version 1.1.166.0 of the MSOnline module. If you don’t have it installed, you can watch Shane’s crappy video walkthrough on installing it. Time marches on, and it marches double-time in the cloud. So while I assume these steps will work later versions of the module, I can’t guarantee that.

To add a domain to your Office 365 tenant, you’ll obviously need a domain. It doesn’t matter where you register the domain, as long as you have the ability to add DNS records. Microsoft does have a deal in place with GoDaddy, so getting your domain there does have some advantages.

Adding the Domain

Once you have the module installed, and the domain purchased it’s time to open up PowerShell and make some magic. Open up “Microsoft Azure Active Directory Module” to get the party started. I christen every PowerShell session with a heaping helping of Start-Transcript, so do that first. Then use Connect-MsolService to connect to your tenant. If you haven’t already added a custom domain to your Office 365 or Azure tenant, then you’re likely logging in with a username that looks like someone@sometenant.onmicrosoft.com, where sometenant is your tenant name, and someone is a tenant admin for that tenant. To get the landscape of the domains in your tenant, use Get-MsolDomain. It looks like this:

SNAGHTML141ce81e

Once you’ve confirmed the domain you want to add isn’t already there you can use New-MsolDomain to add it. The command I ran was 

New-MsolDomain -Name "toddsblog.com"

It might seem like that should be enough. The domain is added, Ta-Da! If that was the case, this would be a very short blog post. We still have a couple of steps left. I have to prove to Microsoft that I own toddsblog.com. Maybe toddsblog.com is Todd Rundgren’s blog, or maybe Todd Bridges. Who knows? To verify that I am truly the Todd behind toddsblog.com, I have to make a specific DNS entry that Microsoft tells me to add.

Before I can add the correct DNS entry, I need to know what it is. The Get-MsolDomainVerificationDns gives me that value. We have two options, we can create a TXT record, or an MX record. Since I’m not moving the mail for toddsblog.com over to Office 365 right now, I went with the TXT record. If I was moving mail in the short term, I would have went for the MX record instead, and saved myself the step of adding it later. To get the TXT record I need, I ran this command:

Get-MsolDomainVerificationDns -DomainName toddsblog.com -Mode DnsTxtRecord

Here is the output I received:

image

I used GoDaddy’s domain management tool to add this record. While the label in the screenshot says “toddsblog.com” I really needed to add a record for @, which tells DNS clients “this domain.” It looked like this:

image

DNS takes its time to move around the Internet, and it gets cached a lot of places along the way. To improve the chances that Microsoft gets the new record, I used nslookup to query a major DNS provider, Google, and make sure it was there:

nslookup -type=TXT toddsblog.com 8.8.8.8

I got the output I expected:

image

Looks good.

The final step is telling Microsoft to check that we made the entry, and made it correctly. Let’s see what happens:

Confirm-MsolDomain -DomainName toddsblog.com

The output looks like I did it right.

image

Let’s check our list of domains again with Get-MsolDomain

 

image

More good news. And finally, in the UI:

image

The domain shows up as “Setup in progress” because I haven’t added all the DNS records Office 365 needs to send email and stuff like that. The domain is still good though. I can assign that domain to users. It’s fully functional.

To recap, here was the whole process:

New-MsolDomain -Name "toddsblog.com"

Get-MsolDomainVerificationDns -DomainName toddsblog.com -Mode DnsTxtRecord

Confirm-MsolDomain -DomainName toddsblog.com

The other stuff was just fun fluff.

I hope this helps, and encourages you to get your PowerShell on when working with Office 365 and Azure.

tk

ShortURL: http://www.toddklindt.com/PoshAddO365Domain

January 16
Podcast 322 - Ten Best Ways to Listen to Todd Klindt's Podcast

In this week's episode Shane and Todd talk about some additions to Microsoft Flow, and the continued, sad demise of the Microsoft Band 2. They also talk about some new licensing options for the Office Online Server, and how the demise of CMD is greatly exaggerated. Oh, and they talk about one unintended side effect of anonymous cars.

Have you heard about Todd's Birthday Charity drive at http://pointgowin.com/tkcharity ? Check it out. It’s the bomb!

Audio File

Video File

Podcast 322 - Ten Best Ways to Listen to Todd Klindt's Podcast (Time 0_01_01;04)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 33:56

Links:

09:51 PSA: Microsoft Band No Longer a Swappable Unit
14:05 Microsoft Flow adds 13 new services
18:07 Office Web Apps and Office Online Server now supported in Azure
20:26 CMD isn't going anywhere
24:23 Self Driving cars will cause an organ shortage
27:27 New version of SPO PowerShell
29:40 Star is coming within 77 Light days of Earth

Brought to you by Rackspace

ShortURL: http://www.toddklindt.com/Podcast322

January 09
Podcast 321 - Not Again...

This week Shane is all alone at the mic while Todd is recovering from his holiday hangover. Who knows what Shane is talking about this week, but it's a good combination of old, new, and Azure. Next week is bound to be better. It just has to be.

Oh, and don’t forget Todd's Birthday Charity drive at http://pointgowin.com/tkcharity

Audio File

Video File

Podcast 321 - Not Again... (Time 0_25_30;19)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 20:48

Links:

France opened a solar road

Brought to you by Rackspace

ShortURL: http://www.toddklindt.com/Podcast321

December 29
Podcast 320 - Ransomware Christmas Special

For the last podcast of 2016 Todd and Shane go off script talk and do something original, they talk about what's happened in 2016 and give their take on it. They talk about football (American football that is), what constitutes a Christmas movie, and mall riots. They spend a little time talking about the tech stories of 2016, like the iPhone, some more about the iPhone, the Galaxy Note 7, hacking, and cars that will drive Shane to Chick-Fil-A any time he'd like.

Another blatant shoutout for Todd's Birthday Charity drive at http://pointgowin.com/tkcharity

Audio File

Video File

Podcast 320 - Ransomware Christmas Special (Time 0_00_23;06)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 59:09

Links:

No links

Brought to you by Rackspace

ShortURL: http://www.toddklindt.com/Podcast320

December 21
Podcast 319 - Back Behind the Barn

In this week's episode Todd and Shane talk about "Reverse DSC." What it is, and what it means for your SharePoint farms. Then we cover some updates to SharePoint 2013 PSConfig and OneDrive For Business. Then we delve into the weighty topic of AI and unending corporate meetings. We finish up with Shane's random thoughts about college football, Italian plumbers, and Star Wars.

Another blatant shoutout for Todd's Birthday Charity drive at http://pointgowin.com/tkcharity

Audio File

Video File

Podcast 319 - Back Behind the Barn (Time 0_04_23;00)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 49:54

Links:

07:45 SharePoint Reverse DSC
11:30 PSConfig improvements announced in August 2016 are now available for SharePoint 2013
15:22 New OneDrive Admin Interface
20:44 Let Microsoft schedule your meetings
25:32 Poor Mac Book helped the Surface
31:13 Manage access at scale

Brought to you by Rackspace

ShortURL: http://www.toddklindt.com/Podcast319

December 19
Podcast 318 - Tighter Than a Goose's Patoot

This week's episode covers a lot of exciting topics. We start the show off talking about a great blog post Todd recently published about a bad error message that PowerShell gives you with Office 365. Then we discuss some new things that Microsoft has released, like the SharePoint Migration Assessment tool, and some documentation on DR for Access Services. We also cover the things to consider when using a WAN accelerator with Office 365.

Oh, and check out Todd's Birthday Charity drive at http://pointgowin.com/tkcharity


Audio File

Video File

Podcast 318 - Tighter Than a Goose's Patoot (Time 0_00_40;26)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 42:03

Links:

05:48 Getting “Unable to assign this license because it is invalid” in Office 365 PowerShell with Set-MsolUserLicense when you know darn well it’s valid
14:23 PowerShell 101 for SharePoint friends
17:44 SharePoint Online software boundaries and limits!
20:08 SharePoint Migration Assessment Tool Release Candidate
21:30 Disaster Recovery best practices for SharePoint Server and Access ServiceS
23:30 WAN accelerators not supported with Office 365
26:09 Lawyer talk on the topic
30:22 Microsoft offering more free Azure training
32:45 Microsoft's 2017 Event Lineup

Brought to you by Rackspace

ShortURL: http://www.toddklindt.com/Podcast318

December 08
Getting “Unable to assign this license because it is invalid” in Office 365 PowerShell with Set-MsolUserLicense when you know darn well it’s valid

I’ve been working on a blog post about the script I use to license users inside of Office 365. It’s a doozy. You’re going to love it, I promise. As a rule, I have someone proof read all of my blog posts, especially ones that have PowerShell code in it. For those of you that have read any of my blog posts, that might come as a shock, but it’s true. When Shane was testing my code he kept getting errors. In this case, I just chalked it up to his ineptitude, which is the source of many of his troubles, so I blew him off. I had tested the crap out of this PowerShell script so I trust it more than I trust Shane.

But a couple of days ago I was running my trusty script and I got the error. Now stuff was getting serious! Here’s the code I ran:

PS C:\> $lic1 = "MOD873457:ENTERPRISEPREMIUM"
PS C:\> $user = "alonso@MOD873457.onmicrosoft.com"
PS C:\> Set-MsolUserLicense -UserPrincipalName $user -AddLicenses $lic1

Here’s the very unpleasant response that PowerShell gave me:

Set-MsolUserLicense : Unable to assign this license because it is invalid. Use the Get-MsolAccountSku cmdlet to retrieve a list of valid licenses.
At line:1 char:1
+ Set-MsolUserLicense -UserPrincipalName $user -AddLicenses $lic1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [Set-MsolUserLicense], MicrosoftOnlineException
    + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.InvalidUserLicenseException,Microsoft.Online.
   Administration.Automation.SetUserLicense

I did like it suggested, and sure enough the SKU was legit:

PS C:\> Get-MsolAccountSku

AccountSkuId                ActiveUnits WarningUnits ConsumedUnits
------------                ----------- ------------ -------------
MOD873457:ENTERPRISEPREMIUM 25          0            1
MOD873457:PROJECTPREMIUM    25          0            0

Here is my failure in pictures

 

SNAGHTML1d5d4728

It turns out that Shane is not an idiot. Well, if he is, this is not an example of it. It’s just a poor error message. While the error says the license is invalid, it’s really not. It threw that error because that user already had that license.

We can verify that with this command:

(Get-MsolUser -UserPrincipalName $user).licenses

The output looks like this:

image

Unfortunately there’s no good way that I know of to tell why you’re getting that error, or walk through a user’s existing licenses and see if it’s already applied. It can be done, but it’s ugly text parsing. If I figure out something elegant, I’ll let you all know.

After much swearing and figuring this out on my own, I did find one vague reference to it in Microsoft’s

Assign licenses to user accounts with Office 365 PowerShell document.

image

Not helpful, Microsoft, not helpful.

 

tk

ShortURL: http://www.toddklindt.com/InvalidO365SKU

December 08
Podcast 317 - No More Blacksmiths

This week Shane and I crown our first Podcast Listener of the Day, though with any contest, there was some controversy. After that is settled, we discuss a few new releases from Microsoft. Things like Azure AD Connect, and the PowerShell cmdlets for Azure AD. We show you how to see every PowerShell command that has ever been run on your machine. We finish up by talking about Amazon Go, and how it won't destroy the lives of Americans everywhere. At least not yet.

Audio File

Video File

Podcast 317 - No More Blacksmiths (Time 0_21_26;00)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 40:33

Links:

12:06 Azure AD ConnectAzure AD Connect 1.1.343.0 released
15:00 https://aka.ms/aadconnect
17:19 AzureAD PowerShell V2.0 is now GA
22:34 Join First PowerShell Core Community Call – Dec 8, 2016
27:12 Amazon Go
29:40 McDonalds unveils job replacing kiosks

Brought to you by Rackspace

ShortURL: http://www.toddklindt.com/Podcast317

December 02
Podcast 316 - Turn that Frown Upside Down

This week's podcast is hilarious mess of production woes. Shane and I try out some streaming software with disastrous effect. Next week will be better. It just has to be. :)

We get the duct tape out, we fix things and we put on a show. We chat about the changes in the Office Patterns and Practices PowerShell cmdlets, and then we spend some time gushing about how great they are. Whole new countries of people get to enjoy Office 365 this week thanks to Microsoft expanding the market. We deliver the good news to them. We finish up by talking about some shenanigans at Reddit and Shane and I's evil plan to get CNN to buy our podcast.

Audio File

Video File

Podcast 316 - Turn that Frown Upside Down (Time 0_00_45;24)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 31:46

Links:

06:02 PNP PowerShell changing from SPO to PNP prefix
11:03 Office 365 in new markets
13:15 Overly complicated explanation of BI/Excel services changes in SharePoint 2016
14:46 No more public websites on March 15, 2017
19:25 Money pit
22:35 Reddit CEO admits to altering posts
27:23 CNN buys popular YouTube star to build a new way to produce news

Brought to you by Rackspace

ShortURL: http://www.toddklindt.com/Podcast316

December 01
Podcast 315 - Touch Me on Grindr

In this episode Shane and I chat about how great my vacation was and how little I missed him while I was gone. Then we talk about exciting topics like Double Dare and Azure Bots. We do cover a couple of important topics like Office Client support, and the Office Online Server updates. We also talk about some sad news around SQL Reporting Services and its future with SharePoint. Spoiler alert, SQL gets to keep the dog in the split.

Audio File

Video File

Podcast 315 - Touch Me on Grindr (Time 0_01_47;24)

YouTube (Subscribe)

Subscribe in iTunes

Running Time: 42:02

Links:

The making of Double Dare on Nickelodeon
Support for the 2013 version of Office 365 ProPlus ends February 28, 2017
Office Online Server updated
Sysinternals update
SQL Reporting Services V.Next will not have SharePoint integrated mode
Azure Bot Service in public preview
Azure Advisor in public preview

Brought to you by Rackspace

ShortURL: http://www.toddklindt.com/Podcast315

1 - 10Next
 

 Subscribe to my Netcast

 

You can watch my SharePoint Netcast live every Monday afternoon at 4:00 Central US time at http://www.toddklindt.com/Netcast

You can subscribe to my SharePoint Netcast in the following four ways:

MP3 Audio

Windows WMV video

iOS M4V video

YouTube Channel

 

 SPDocKit

 
 

 Todd's Upcoming Events

 
  
  
There are no items to show in this view of the "Events" list.