It is difficult to configure access to Microsoft 365 Online email via Azure PowerShell runbooks. It is much easier to configure a plugin to handle sending of emails. Twilio SendGrid is the preferred option, and this has already been added to the Speaakeasy Azure environment. It supports sending of 100 emails per day for zero cost. The configuration can be found under the Azure resources, listed as SpeakeasyAzureEmailSender. Having configured Twilio SendGrid, a small script can easily be added to a PowerShell script to send emails. It just uses an API key, which has been stored as an Azure automation variable., “TwilioSendGridAPIKey” The script can be found in a few of the existing Azure automation runbooks.
Preventing Twilio mail from being treated as SPAM
Monitoring Twilio SendGrid Activity
Navigate to SpeakeasyAzureEmailSender, then click on the link named “Open SaaS Account on publisher’s site”. The daily usage of Twilio by Spekeasy can then be seen.