Tuesday 19 September 2017

How to change the display name of a guest in Microsoft Teams

Hello Readers.  Hope you're well.

Another quick post.

Microsoft has enabled external Guest access in Teams.  And I know you've all been frantically adding guests to your teams.  

I'm a guest in a couple of teams of like-minded individuals.  One of the biggest complaints is the display name.  When you add a guest to a team in Teams, the display name is the alias of the User Principal Name (UPN) by default.  

I explain in a previous blog post that it is possible to specify the display name before the invite goes out.  In this post I'll go through the ways you can change the display name of your guests after the invite goes out and they've already accessed your team.

There are two ways to do this.  I'll start with the quickest and easiest.  PowerShell.

First, you need the pre-requisites for connecting to Azure AD in PowerShell.

1. You need the Microsoft Online Services Sign-In Assistant for IT Professionals RTW.  Download the version you want and install.

2. Next, you need the Azure Active Directory PowerShell Module.  Download the .msi file, and click Run to run the installer package.

Change the display name of a guest using PowerShell

1. First, open PowerShell as an Administrator

2. Now type Connect-MsolService and enter your admin credentials when prompted.


3. Now enter Get-MsolUser -All | where {$_.UserType -eq "Guest"} to see a list of your guests.


If you know the UPN of the guest you want to display you can do a search:
Get-MsolUser -SearchString "randy.chapman"

4. To change the display name you can simply copy the UserPrincipalName from the results above and run the following command: 
Set-MsolUser -UserPrincipalName first.last_guestdomain.com#EXT#@yourdomain.com -DisplayName "First Last (Company)"
You also have a some more options here to make it a little easier.

You can assign a variable to use in the Set-MsolUser command.
$guest = Get-MsolUser -SearchString "randy.chapman" | select -expandproperty UserPrincipalName

Then you can insert the variable to make the change.
Set-MsolUser -UserPrincipalName $guest -DisplayName "Randy Changed"

Now if you look up the user you changed, you'll see the new display name is shown.

In addition to the Display Name, you can also set loads of other parameters such as FirstName, LastName, Title, PhoneNumber and various address fields.  All good, but your users won't see that info in Teams anyway.  

Remove or disable a guest in PowerShell

You can also use PowerShell to remove a guest or disable them without removing them.

To remove, enter: 
Remove-MsolUser -UserPrincipalName first.last_guestdomain.com#EXT#@yourdomain.com
To disable without removing, enter: 
Set-MsolUser -UserPrincipalName first.last_guestdomain.com#EXT#@yourdomain.com -BlockCredential $True
This is the PowerShell Equivalent of the Block Sign In, in the Azure AD admin portal.


As I said at the beginning of the post, there is another way to do this and that is in the Azure AD admin portal.

Change the display name of a guest in the Azure AD Admin portal

1. First, Sign in to Office 365 Admin portal at https://portal.office.com/adminportal/home.

2. Click on the Admin Tile


3. Scroll Down and expand Admin Centres and click on Azure AD

4. Now click on Users and Groups -> All Users -> click on the user you want to edit 

5. Click on Profile 


6. Enter the new Display Name in the Name field and click Save

You can change multiple settings and even set a photo.  Again, none of this will be visible in Teams, so I wouldn't bother.

Some important notes

I discovered that if you set a First Name and Last name, that is displayed in Teams rather than the DisplayName.

You won't see the guest user display name changes until you completely log out of Teams and then log back in.  Switching teams isn't enough.

That's all folks.

____________________________________________________________________________________


I hope you found this useful.  Thank you for reading.

If this or any other post has been useful to you please take a moment to share.  Comments are welcome.