What's In Your Profile #5 - Add-SendAsPermission

Adding SendAs permissions for a mailbox on Exchange Online tends to be one of the pickier things we tend to need to do. Canonical issues reach the top of the list of common issues, causing the GUI interface to Exchange Online to become worthless. Adding the permission with PowerShell has been my go to.

Typically in the past, I've needed to use the Add-ADPermission cmdlet to get this function, but now that we're mostly migrated to Exchange Online, I've started using Add-RecipientPermission more frequently. You can find examples of both below. The Add-RecipientPermission is written as a function as it's something I've added into my $profiile.

function Add-SendAsPermission {
           [Parameter(Mandatory = $True)]
           [String]$User = (Read-Host Who Needs Permissions?)
           [Parameter(Mandatory = $True)]
           [String]$SharedMailbox = (Read-Host Where do they need permissons? `(Enter Full Email`))
    $useraccount = Get-ADUser $User -Properties EmailAddress
    $useraccountemail = $useraccount.EmailAddress
    write-host $useraccount
    Write-Host $useraccountemail

    Add-RecipientPermission -Identity $SharedMailbox -Trustee ($useraccount.EmailAddress) -AccessRights SendAs -Verbose

And a quick example of Add-ADPermission
Add-ADPermission [email protected] -User mriston -AccessRights ExtendedRight -ExtendedRights "SendAs" -Verbose;

Until Next Time!


Popular Posts