Azure Communication Services SMTP Relay Assistance

Drew Tomlinson 0 Reputation points
2024-10-23T00:05:48.76+00:00

My situation is that I run my own smtp mail server for personal use to handle email for my domain. I like to have it receive email, then do some basic spam filtering, and finally forward the email to my Gmail account. I used to do this without issue but I can no longer send mail directly from my personal server due to spam mitigation on both Google and my ISP. Thus, I'm trying to implement ACS for smtp relay.

I think I am most of the way there and can even send test email via the "try email" option in the portal. From what I gather, my next step is to register an app in Entra ID for ACS which will create a username/password I can use to relay. This is where I'm stuck. I've been following the info here but it's extremely vague for someone that doesn't already know everything:

https://techcommunity.microsoft.com/t5/azure-communication-services/send-emails-via-smtp-relay-with-azure-communication-services/ba-p/4175396

I'd really appreciate any help you might be able to give me, even if it's just a link to a tutorial specific to ACS smtp relay.

Azure Communication Services
Azure Communication Services
An Azure communication platform for deploying applications across devices and platforms.
1,251 questions
Microsoft Security | Microsoft Entra | Microsoft Entra ID
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 22,031 Reputation points Volunteer Moderator
    2024-10-23T09:02:22.4866667+00:00

    Hello Drew Tomlinson,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you are in need of assistance to make sure your SMTP relay with Azure Communication Services works effectively.

    With your explanations, you're very well on the right track with setting up Azure Communication Services (ACS) for SMTP relay. In the below lists of actons, observe what yo've done and what you have not as follow:

    The first thing is to Register your app in Entra ID via Azure portal by navigating to Azure Active Directory > Select App registrations and then new registration > Fill in the required fields and register the app > and once registered, go to the app’s Certificates & secrets section to create a new client secret. Note down the Client ID, Tenant ID, and the Client Secret.

    Secondly, In the Azure portal, navigate to Azure Communication Services > Select your ACS resource and go to Access control (IAM) > Create a custom role with permissions to send emails. You can clone the Reader role and add the necessary actions for email sending.

    Then, use the following SMTP settings:

    SMTP server address: smtp.azurecomm.net

    Port: 587

    Username: <ACS Resource Name>.<Entra Application ID>.<Entra Tenant ID>

    Password: The client secret you generated.

    After all the above, you will need to test mail using any email client to test sending emails. Here I used a PowerShell for an example:

    $Password = ConvertTo-SecureString -AsPlainText -Force -String '<Client Secret>'
    $Cred = New-Object -TypeName PSCredential -ArgumentList '<ACS Resource Name>.<Entra Application ID>.<Entra Tenant ID>', $Password
    Send-MailMessage -From '******@yourdomain.com' -To '******@gmail.com' -Subject 'Test Email' -Body 'This is a test email.' -SmtpServer 'smtp.azurecomm.net' -Port 587 -Credential $Cred -UseSsl
    

    For more steps and detailed guide, you can refer to the Microsoft Learn links here: https://learn.microsoft.com/en-us/azure/communication-services/quickstarts/email/send-email-smtp/send-email-smtp

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.