Administrators who need to limit app access to specific mailboxes can create an application access policy by using the New-ApplicationAccessPolicy PowerShell cmdlet. This article covers the basic steps to configure access control for GrinMark Synchronizer. These steps are specific to Exchange Online resources.
https://learn.microsoft.com/en-us/graph/auth-limit-mailbox-access
Navigate to Exchange admin center > Recepients > Groups > Mail-enabled security
https://admin.cloud.microsoft/exchange#/groups

Get-Module -Name ExchangeOnlineManagement -ListAvailable
Install-Module -Name ExchangeOnlineManagement
Connect-ExchangeOnline
This should now work, prompting you for your credentials.
Your account needs the necessary permissions to assign the ApplicationImpersonation role. You need to have an account with either the Global Administrator role or the Exchange Administrator role.
Connect-ExchangeOnline -UserPrincipalName youradmin@domain.com
Get-DistributionGroup -Identity "<GroupObjectId>"
Here GroupObjectId is the ID you copied from the browser address bar on the first step.
New-ApplicationAccessPolicy -AccessRight RestrictAccess -AppId "b361979a-3ccf-4bcd-b3cf-b5acb60e8e0f" -PolicyScopeGroupId "<GroupObjectId>"
Get-ApplicationAccessPolicy | Where-Object { $_.AppId -eq "b361979a-3ccf-4bcd-b3cf-b5acb60e8e0f" } | Format-Table -AutoSize
Test-ApplicationAccessPolicy -AppId "b361979a-3ccf-4bcd-b3cf-b5acb60e8e0f" -Identity "user@domain.com"
Expected output:

Ensure your application has been granted the EWS.AccessAsUser.All permission with admin consent:
https://portal.azure.com/#home
