I recently had to provision MS Teams for all organizational units inside my company and I decided to use Teams powershell script ( Teams powershell was on preview when I was doing this provisioning) to create teams. There is pretty good documentation about the powershell scripts for MS Teams and I used it as my reference point. The create team command looked very straightforward as below:
New-Team -DisplayName "Tech Reads" -Description "Team to post technical articles and blogs" -Visibility Public
So if you see the example taken from Microsoft Official documentation, it looks pretty straighforward as the only Mandatory attribute you need to specify in the New-Team command is the DisplayName. But the problem is when you execute the command and you go back to admin center and check the name of the mailbox created it would randomly assign a name with the format msteams_<someaplphanumeric>.
So, the fix is pretty simple, do not run the New-Team command without passing MailNickname attribute. So the corrected command for above example would be as below:
New-Team -DisplayName "Tech Reads" -MailNickname "TechReads" -Description "Team to post technical articles and blogs" -Visibility Public
I hope Microsoft will either make the MailNickName mandatory or use the DisplayName value without spaces for mailbox name.