Search code examples
microsoft-graph-apimicrosoft-graph-sdks

Allow Azure AD app to send mails on behalf of only one specific user


I'm building a daemon service (no user interaction) which needs to send a mail via MS Graph. I've registered an app in Azure AD and given it the User.Read.All and Mail.Send application permissions and given admin consent for those.

In my Java code, I'm using the ClientSecretCredentialBuilder for authentication. By doing

graphServiceClient.users("johndoe@mytenant.com").sendMail(params).buildRequest().post();

I can send an email on behalf of John Doe. However, technically, I could send an email on behalf of any user in this tenant. Is there a way to configure the app so that it can only use a specific account to send mail from?


Solution

  • Graph API doesn't yet support such a feature.