Categories

If you are looking for a way to grant SendAs/SendOnBehalf to M365 Groups you can use the following script:


PowerShell:


You use the GrantSendOnBehalfTo parameter on the various mailbox and group Set- cmdlets to manage the Send on Behalf permission for mailboxes and groups:

  • Set-Mailbox
  • Set-DistributionGroup: Distribution groups and mail-enabled security groups.
  • Set-DynamicDistributionGroup
  • Set-UnifiedGroup: Microsoft 365 groups.
<Cmdlet> -Identity <MailboxOrGroupIdentity> -GrantSendOnBehalfTo <Delegates>


You use the Add-RecipientPermission and Remove-RecipientPermission cmdlets to manage the Send As permission for mailboxes and groups


<Add-RecipientPermission | Remove-RecipientPermission> -Identity <MailboxOrGroupIdentity> -Trustee <DelegateIdentity> -AccessRights SendAs



In Coreview:


{
   "id": "8cce8353-ddee-4d44-a824-f52f329cf70f",
   "title": "Exchange - Grant SendAs/SendOnBehalf on M365 groups",
   "lastModified": "2022-05-16T12:29:45.4590000Z",
   "target": "None",
   "tags": [],
   "vars": [
      {
         "name": "M365groupemailaddress",
         "type": "string",
         "isRequired": true
      },
      {
         "name": "Right",
         "type": "list",
         "values": "SendAs,SendOnBehalf",
         "isRequired": true
      },
      {
         "name": "User",
         "type": "string",
         "isRequired": true
      }
   ],
   "params": [],
   "columns": {},
   "version": 4,
   "statement": "param ([string]$M365groupemailaddress, [string]$Right, [string]$User)\r\n\r\nif($Right -eq \"SendAs\"){\n    Add-RecipientPermission $M365groupemailaddress -AccessRights $Right -Trustee $User -Confirm:$false\n}\nelseif($Right -eq \"SendOnBehalf\"){\n    Set-UnifiedGroup -Identity $M365groupemailaddress -GrantSendOnBehalfTo @{add=\"$($User)\"}\n}"
}