Create a new mailbox in Exchange Online
Setup a new mailbox non-hybrid, non-AD synced environment only.
New-Mailbox -Alias sunil -Name "Sunil Chauhan" -FirstName Sunil -LastName Chauhan -DisplayName "Sunil Chauhan" -MicrosoftOnlineServicesID firstname.lastname@example.org -Password (ConvertTo-SecureString -String 'P@ssw0rd' -AsPlainText -Force) -ResetPasswordOnNextLogon $true
Delete or restore user mailboxes
Soft-deleted user mailboxesA soft-deleted user mailbox is a mailbox that has been deleted using the Office 365 admin center or the Remove-Mailbox cmdlet in the Exchange Management Shell and has still been in the Azure active directory (Azure AD) recycle bin for less than 30 days.
Hard-deleted user mailboxesA hard-deleted user mailbox is a mailbox that has been soft-deleted for more than 30 days, and the associated Azure active directory user has been hard-deleted or was deleted using the Remove-Mailbox -PermanentlyDelete cmd.
All mailbox content such as emails, contacts, and files will be permanently deleted.
Delete a user mailboxA deleted mailbox stays in soft-deleted state for 30 days post which Mailbox is deleted permanently unless Litigation hold was not placed.
Remove-Mailbox -Identity "Sunil Chauhan"
Using Azure AD shell to delete a mailbox permanently.
Remove-MsolUser -UserPrincipalName <sunil chauhan> -RemoveFromRecycleBin true
Restore a user mailbox
Run the following cmd to undo a mailbox deletion.
Undo-SoftDeletedMailbox email@example.com -WindowsLiveID firstname.lastname@example.org -Password (ConvertTo-SecureString -String 'Pa$$word1' -AsPlainText -Force)
Restoring a user in a hybrid scenarioIf the mailbox has been soft-deleted and the Azure active directory user that was associated with the mailbox has been hard-deleted from Azure Active Directory, you can use New-MailboxRestoreRequest to recover the mailbox.
Retrieve the GUID for the soft-deleted mailbox that you want to restore.
$SoftDeletedMbx = get-mailbox Sunil -SoftDeletedMailbox
This cmdlet will return a GUID of soft-deleted mailboxes.
Run the following cmdlet to restore the mailbox.
New-MailboxRestoreRequest -SourceMailbox $SoftDeletedMbx.Guid -TargetMailbox <GUID from new target mailbox you've created>