I just created 80 Azure AD users via PowerShell that I wanted to activate for email. Normally you can use Enable-Mailbox when using Exchange On-Premises to activate Active Directory based user (who don't yet have mailboxes so it seem obvious this would be command I need. Quick look for Enable-Mailbox on Microsoft website doesn't have big warning sign to not use it.. so I did….
The command I used was
foreach ($User in $UsersNonExistantAzure) { Enable-Mailbox -Identity $User.MailNickName -WhatIf }
To my surprise following errors occurred
WARNING: After you create a new mailbox, you must go to the Office 365 Admin Center and assign the mailbox a license, or it will be disabled after the grace period.
The following error occurred during validation in agent 'Archive ParameterSet Enforcement Agent': 'This operation only works with Archive or PermanentlyDisable parameters.'
+ CategoryInfo : NotSpecified: (:) [Enable-Mailbox], ProvisioningValidationException
+ FullyQualifiedErrorId : [Server=VI1P194MB0094,RequestId=b9b8a0e8-c2bc-4397-be24-dd57dfe04107,TimeStamp=26.09.2018 19:39:32] [FailureCategory=Cmdlet-ProvisioningValidat
ionException] 1BD65423,Microsoft.Exchange.Management.RecipientTasks.EnableMailbox
+ PSComputerName : outlook.office365.com
If you're on-premises the fix is simple that you should use this command on your local Microsoft Exchange. However I wasn't. But the fix is actually as simple as it get. Just assign a license to a user!
Set-MsolUserLicense -UserPrincipalName $User.UserPrincipalName -AddLicenses "evotec:ENTERPRISEPACK"
After I did… things went smoothly
And mailboxes started showing up on Exchange Online