Trying to do something like this to add members of an azure dynamic security group to the shared mailbox they belong to based on CSV info
Import-Csv C:\users\jeiger\desktop\kiosknames.csv | ForEach-Object {
foreach ($kioskgroup in $_.kioskgroupname){
foreach ($user in $kioskgroup){
Add-MailboxPermission $_.kioskemail -User $user -AccessRights FullAccess -AutoMapping $false
Add-RecipientPermission $_.kioskemail -AccessRights SendAs -Trustee $user
}
}
}
Headers would read something like: kioskgroupname and kioskemail
Make sure you install the Azure AD Module and EXO V2 module.
Refer to this script: