Over the last couple of days, I’ve spent sometime on Azure Automation (SMA in Azure). The first thing I did was imported and configured the SendEmail and SendPushNotification SMA Integration Modules that I have posted earlier. I created a simple test runbook to send an email and a push notification to my android phone:
#Get the contact details
$ContactName = 'tyang'
Write-Verbose "Getting SMA Address Book entry for $ContactName"
$Contact = Get-AutomationConnection -Name $ContactName
Write-Verbose "Contact: $Contact"
#Get SMTP settings
Write-Verbose "Getting SMTP configuration"
$SMTPSettings = Get-AutomationConnection -Name 'GmailSMTP'
$Subject = "Test message from Azure Automation"
$Message = "Hello, this is a test message from Azure Automation."
Write-Verbose 'Sending email'
$Send = Send-Email -SMTPSettings $SMTPSettings -To $Contact.Email -Subject $Subject -Body $Message -HTMLBody $false
#Android Push Notification
Write-Verbose 'Sending Android push notification'
Send-MobilePushNotification -os "Android" -apikey $Contact.AndroidAPI -Subject $Subject -Application 'Azure Automation' -Body $Message
However, I found 2 issues related to the SendEmail module. I’ll go through both of the issues in this post. Issue 1 When I executed this runbook, it failed to send the email message. I got this error: Cannot find the ‘Send-Email’ command. If thisContinue reading