Using Powershell from my local desktop, I am able to successfully send an outgoing email to our O365 email server:
$mycredentials = Get-Credential Send-MailMessage -smtpServer company.mail.protection.outlook.com -credential $mycredentials -from 'email@example.com' -to 'firstname.lastname@example.org' -subject 'TestSubject'
However, I get an error using the exact same commands/credentials/values when attempting to send mail from the Azure VM.
I have opened Port 25 and 587 on both the Windows Firewall and the Azure Firewall for the VM.
Any other suggestions on why this might be working on my local desktop but not on the Azure VM?