Skip to content

Instantly share code, notes, and snippets.

View sikkepitje's full-sized avatar

Paul Wiegmans sikkepitje

View GitHub Profile
@sikkepitje
sikkepitje / HowTo-MailSendLimitAccessOneMailbox.ps1
Created February 15, 2023 15:56
PowerShell Example restricting Office 365 mail sending application to use only one sender address
<#
HOW TO permissie voor mail versturen beperken tot één mailbox
#>
Install-Module -Name ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline -UserPrincipalName <YOUR_USERNAME>
New-DistributionGroup -Name "MyEmailService" -Alias myemailservice -Type security
New-ApplicationAccessPolicy -AppId <YOUR_CLIENT_Id> `
-PolicyScopeGroupId <YOUR_GROUPs_PRIMARY_EMAIL> -AccessRight RestrictAccess `