Set up Migadu DNS on Azure DNS
This guide shows how to configure DNS records for Migadu on Azure DNS, including SPF, DKIM, DMARC, MX, and domain verification records. The fastest way to do this is with the mail2dns CLI, which automatically creates all required records for your domain in seconds.
Setup
If needed, install mail2dns before following the below steps:
npm i -g mail2dns Note: The Azure CLI must be installed, configured and authenticated. mail2dns will use the active subscription, or you can specify a subscription by supplying the ID or name to the ‑‑subscription option or
AZURE_SUBSCRIPTION_ID environment variable
The account used must have the following permissions:
Microsoft.Network/dnszones/readMicrosoft.Network/dnszones/*/readMicrosoft.Network/dnszones/TXT/writeMicrosoft.Network/dnszones/MX/writeMicrosoft.Network/dnszones/CNAME/write
Run the following command and answer the prompts to create DNS records at Azure DNS:
mail2dns setup [YOUR_DOMAIN] migadu azure You will be prompted to input the following values:
-
Migadu verification TXT value
In your Migadu account page, go to Email Domains > [Email Domain] > DNS Configuration > Setup Instructions and copy the full TXT record value shown under `Verification TXT Record`.
Set the following environment variables:
MIGADU_VERIFY_TXT= Then run the following command to create DNS records at Azure DNS:
mails2dns setup [YOUR_DOMAIN] migadu azure Environment Variables Reference
-
MIGADU_VERIFY_TXT
Migadu verification TXT value. In your Migadu account page, go to Email Domains > [Email Domain] > DNS Configuration > Setup Instructions and copy the full TXT record value shown under `Verification TXT Record`.
Run the following command, supplying the required options, to create DNS records at Azure DNS:
mails2dns setup [YOUR_DOMAIN] migadu azure --verify-txt [MIGADU_VERIFY_TXT] Options Reference
-
--verify-txt
Migadu verification TXT value. In your Migadu account page, go to Email Domains > [Email Domain] > DNS Configuration > Setup Instructions and copy the full TXT record value shown under `Verification TXT Record`.
That's it! After running the setup command, the required DNS records will be created for your domain at Azure DNS to work with Migadu.
Optional Flags
--subscription Azure subscription ID to use -o --no-mx Skip MX records (set up DNS for outbound email only) -y --yes Skip confirmation prompts (the command will error if any required inputs are missing) --allow-insecure-flags Allow secrets to be passed via command-line flags (not recommended) -d --dry-run Show records that would be created without applying them DNS records required for Migadu
Migadu requires the following DNS records to send and receive email from your domain. These are created automatically by the mail2dns setup command:
TXT Record
@ → {VERIFY_TXT}
MX Record
@ → aspmx1.migadu.com
MX Record
@ → aspmx2.migadu.com
TXT Record
@ → v=spf1 include:spf.migadu.com -all
TXT Record
_dmarc → v=DMARC1; p=none;
CNAME Record
key1._domainkey → key1.{DOMAIN}._domainkey.migadu.com
CNAME Record
key2._domainkey → key2.{DOMAIN}._domainkey.migadu.com
CNAME Record
key3._domainkey → key3.{DOMAIN}._domainkey.migadu.com
Protecting Secrets
When running the mail2dns setup command, if you provide credentials via flags these will be visible in your shell history and process list.
To avoid this, you can provide credentials via environment variables or interactively. If you understand the risks and still want to provide credentials via flags, you should take steps to ensure that the input is not saved in shell history, and avoid running it on a shared or public machine.
By default, the setup command will error if you provide secrets via flags: to enable them you must opt in by passing the --allow-insecure-flags option, or setting M2D_ALLOW_INSECURE_FLAGS=true environment variable.
Non-interactive mode
You may wish to run the mail2dns setup command without any confirmation prompts (by default, mail2dns asks you to confirm the DNS records it creates before applying them). To do this, use the ‑‑yes or ‑y flag with the setup command. Be sure to review the DNS records that will be created before running the command with this flag, as it will apply all changes without confirmation.
Any mix of flags and environment variables may be used to provide the required values. By default any missing values will be prompted for, or in non-interactive mode the command will produce an error if there are missing required values.
Related Setups
For Migadu
- Set up Migadu DNS on Cloudflare
+
- Set up Migadu DNS on Amazon Route 53
+
- Set up Migadu DNS on Google Cloud
+
- Set up Migadu DNS on Vercel
+
- Set up Migadu DNS on DigitalOcean
+
- Set up Migadu DNS on GoDaddy
+
- Set up Migadu DNS on Netlify
+
- Set up Migadu DNS on Hetzner
+