how can I send email using the azure cli?

David Broggy 5,701 Reputation points MVP
2022-08-14T13:11:00.773+00:00

Plan A:
I would like to run some powershell commands using the Azure cli and then send the output to an email.
Is that possible? If so, what are the steps in an example?

Plan B:
How do I send Azure cli output to a Log Analytics Workspace?

Thanks!

Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
836 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. msrini-MSFT 9,276 Reputation points Microsoft Employee
    2022-08-14T15:42:05.763+00:00

    Hi,

    You can run PowerShell commands and store those output on a variable and then you can send an email.

    To send email, you can check this doc: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/send-mailmessage?view=powershell-7.2

    Regards,
    Karthik Srinivas