Steps:1 Register application on Azure with client secret and provide the below permissions.



Step2: Restrict this Application to specific users only as if we not restrict it there will be security concerns.


Create a security group and add the email Id to this group.


New-DistributionGroup -Name "AppDistGrp" -Members "automailer@mrccgroup.com" -Alias "AppDistGrp" -Type "Security"


Create policy to define the scope.


New-ApplicationAccessPolicy -AccessRight RestrictAccess -AppId "46c8a78a-4198-40b9-ac90-d4ed4aaf68b7" -PolicyScopeGroupId "AppDistGrp" -Description "Restrict this app's access to members of security group automailer ID"