Restrict Application Access
Use Case: An application uses OAuth 2.0 to connect and send mail as a user. This requires that you Grant Admin Consent, but that allows the application to send as any user. To prevent abuse, you want to restrict which users the app can send-as.
First, Connect to Microsoft 365 Exchange Online
Restrict Application Access
New-ApplicationAccessPolicy -AccessRight RestrictAccess -AppId "e7e4dbfc-046f-4074-9b3b-2ae8f144f59b" -PolicyScopeGroupId EvenUsers@AppPolicyTest2.com -Description "Restrict this app's access to members of security group EvenUsers."