How can I send emails from an Azure runbook?

0
8
Asked By CloudVoyager92 On

Hi everyone! I'm currently working in an Azure tenant using a Microsoft domain (contoso.onmicrosoft.com) and I'm looking to create a CSV list of users each month based on certain filters, then email that list to someone. My Entra ID domain doesn't have any O365 licenses or custom domain names.

I've got the user filtering and Runbook set up using managed identity and the necessary permissions, but I'm unsure how to handle the emailing. I found some info that suggests using Azure Communication Services (ACS) for sending emails, but I'm uncertain if that's the best approach. I'd appreciate any insights or advice on this!

4 Answers

Answered By ScriptMaster2000 On

I've previously managed this with a PowerShell runbook that sends emails using the REST API of Azure Communication Services. It definitely can be done!

UserHelpPleaser -

Did you mean Azure Communication Services? Just want to be sure!

Answered By SkyCoder88 On

I’ve had success using Azure Communication Services for notifications. I even created a Golang CLI tool for that purpose, which you can check out here: [azemailsender](https://github.com/groovy-sky/azemailsender). It's quite powerful if you're open to that route!

CloudVoyager92 -

Sounds interesting! But it looks a bit complex for my level. Why would I choose this over simpler options?

Answered By EmailPro99 On

ACS now supports SMTP, so it should work well for your needs. Alternatively, you might consider SendGrid as a simpler solution. ACS typically provides a default sending domain, while you'll need to set up your own for SendGrid, which could be a consideration depending on your requirements.

CloudVoyager92 -

Thanks for the tip! Not wanting to buy a new domain does make SendGrid less appealing for us.

Answered By TechGuruX On

You might want to look into using Microsoft Graph API instead. It's straightforward to implement with a managed identity and it allows you to send emails directly from specified mailboxes without needing to set up additional services.

CloudVoyager92 -

That makes sense! I actually have access to another tenant with O365 licenses. Can you share any resources on how to connect and send emails this way?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.