Deploying Azure Email Communication Service with Bicep

Thomas Pentenrieder
medialesson
Published in
2 min readJun 27, 2023
Creating an Azure Email Communication Service with Bicep

To be able to use send Emails through the Azure Communication Service you need a few ressources that are best created using Infrastructure-as-Code — in this case with Bicep.

Here’s what we need:

  • Email Communication Service
  • Email Communication Services Domain — either provided by Azure which is good for testing purposes or a custom one for production
  • SenderUsername for the domain (e.g. noreply@mydomain.com)
  • Communication Service that is linked to the Domain

To support different environments we also want to use an Azure-managed domain e.g. for dev & test scenarios and a proper custom domain for production.

Note

Only a sucessfully verified Email Communication Service Domain can be linked to the Communication Service. So you might need to run the script, verify the domain when it first fails and then run the script again.

Code

Here’s the full code which can be called directly as a module by just passing the info if we’re in a production environment or not.

Also check out Philipp’s blog post about how to use the Azure Email Communication Service with .NET:

Originally published at https://medienstudio.net on June 27, 2023.

--

--