you need to assign the "Exchange Recipients Management" role, which grants the necessary permissions to modify mailbox properties, including email addresses.
Help - I am unable to set an email alias in an Azure Runbook
Eric Neiner
51
Reputation points
I have a need to create email aliases for exchange accounts. I am attempting to do this with an Azure Automation Runbook.
Connect-ExchangeOnline -ManagedIdentity -Organization "myorg.onmicrosoft.com"
# Interact with query parameters or the body of the request.
$name = $Request.Query.Name
if (-not $name) {
$name = $Request.Body.Name
}
$user = $Request.Query.User
if (-not $user) {
$user = $Request.Body.User
}
Get-Mailbox -Identity $name | Format-List
#Set-Mailbox $user -EmailAddresses @{add="{"+$name+"@myorg.com"}
Get-Mailbox is working but set-mailbox is failing with Failed (Unauthorized).
I have a managed service account with Exchange online permissions. Which I know is working because Get-Mailbox is working.
Does anyone know what permissions need to be set on this to allow this from set-mailbox Azure powershell in this scenario?
Exchange Online
Exchange Online
A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.
Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
Windows for business | Windows Server | User experience | PowerShell
Answer accepted by question author
-
Sedat SALMAN 14,280 Reputation points MVP Volunteer Moderator2023-03-26T15:55:15.4733333+00:00