How do you add a DMARC record in Google Cloud DNS?
To add a DMARC record in Google Cloud DNS, open the Cloud DNS zones page, select the domain's public zone, click Add standard, enter _dmarc as the DNS name, choose TXT as the Resource record type, and enter a value such as "v=DMARC1; p=none; rua=mailto:reports@example.net". Set a TTL and click Create.
The record itself is simple. The Google Cloud details around it cause most of the trouble: which project holds the zone, whether that zone is public or private, how gcloud splits values on commas, and who has permission to change it. This guide covers the console steps, TXT quoting, the gcloud dns record-sets commands, IAM roles, delegation checks and running DMARC across many client projects. For what each tag means, read how to create a DMARC record step by step; for the protocol itself, see the DMARC guide.
Key takeaways
- The DMARC record is a TXT record set named
_dmarc.example.com.in the domain's public managed zone. A private zone is only visible to authorised VPC networks, so receivers never see it. - Enclose the value in double quotes. Google Cloud DNS limits each string to 255 characters and each TXT record to 1,000 characters.
gcloud dns record-sets createandupdatetake--rrdatas, which is a comma-separated list. Aruatag with two addresses needs gcloud's alternate delimiter syntax, or it is split into two records.- A zone only answers for the domain when the registrar lists that zone's
ns-cloud-*.googledomains.comname servers. Different zones get different name servers, so check before you edit. - Cloud DNS supports IAM at project level and per zone, with IAM conditions down to a single record set. MSPs can grant a DMARC role without handing over the whole project.
Which Cloud DNS zone should hold the DMARC record?
Use the public managed zone that the domain is delegated to. Google's key terms page says a public zone is visible to the internet, while a private zone can only be queried by the Virtual Private Cloud (VPC) networks you authorise. Mail receivers query public DNS, so a _dmarc record in a private zone does nothing for email.
Projects often hold both kinds of zone for the same name, because private zones enable split horizon DNS. A zone called example.com does not tell you which kind it is.
| Zone type | Who can query it | Put _dmarc here? |
|---|---|---|
| Public zone, delegated at the registrar | Everyone on the internet | Yes |
| Public zone with the same DNS name, not delegated | Nobody in practice | No: find the delegated zone |
| Private zone (split horizon) | Only authorised VPC networks | No: receivers never query it |
The visibility field in the ManagedZone resource is either public or private. To list only public zones for a domain in a project:
gcloud dns managed-zones list
--project=client-a-dns
--filter="dnsName=example.com. AND visibility=public"
What is the private zone trap?
A VM inside a VPC that is authorised for a private example.com zone cannot see the public _dmarc record. Google's name resolution order page says that when a private zone is the match and contains no matching record, Cloud DNS returns NXDOMAIN. Public DNS is only used when no private zone matches.
So a dig run from a Compute Engine instance can report "no DMARC record" while the public zone is correct. Engineers then add _dmarc to the private zone to make the test pass, which changes nothing for receivers. Always test from outside Google Cloud, or query the public zone's name servers directly.
How do you check the domain is delegated to Cloud DNS?
Compare the domain's live NS records with the name servers assigned to the zone. In the console, open the zone and click Registrar setup at the top right of the Zone details page. With gcloud, run gcloud dns managed-zones describe and read the nameServers field. Then query NS from outside Google Cloud.
gcloud dns managed-zones describe example-com
--project=client-a-dns
--format="value(nameServers)"
$ dig +short NS example.com
ns-cloud-a1.googledomains.com.
ns-cloud-a2.googledomains.com.
ns-cloud-a3.googledomains.com.
ns-cloud-a4.googledomains.com.
Google's guide to updating your domain's name servers shows this ns-cloud-a1 to ns-cloud-a4 pattern and states that different managed zones have different name servers. The letter after ns-cloud- varies by zone. If the live NS records match the zone, it is authoritative. If they show another ns-cloud- set, the domain is delegated to a different zone, possibly in another project.
If the NS records point somewhere else entirely, add the record where DNS actually lives: Amazon Route 53, Cloudflare, DigitalOcean or Azure DNS. On Windows, Resolve-DnsName -Name example.com -Type NS gives the same answer, and our DNS lookup tool works without a terminal.
How do you create the DMARC record in the Google Cloud console?
Go to the Cloud DNS zones page, click the zone name, then click Add standard. On the Create record set page, enter _dmarc as the DNS name, select TXT, set the TTL and TTL unit, enter the quoted DMARC value and click Create. These steps follow Google's guide to adding, updating and deleting records.
- In the project selector, choose the project that owns the delegated public zone.
- Go to the Cloud DNS zones page and click the zone name, for example
example-com. - Check the record list for an existing TXT record set at
_dmarc.example.com.. If one exists, edit it instead (see below). - On the Zone details page, click Add standard.
- DNS name:
_dmarc. The console appends the zone's DNS name and adds the trailing dot for you. - Resource record type: TXT.
- TTL and TTL unit: for example 5 minutes while you are making changes.
- In the TXT data field, enter the DMARC string in double quotes, on one line.
- Click Create.
A first record in monitoring mode:
"v=DMARC1; p=none; rua=mailto:reports@example.net"
To change an existing record, open the zone, click Edit next to the _dmarc TXT record set, change the value and click Save. Do not use Add item to add a second DMARC string: each item is a separate TXT value at the same name. Under RFC 9989, Section 4.10, if multiple DMARC records are returned for one name, they are all discarded.
For a subdomain such as marketing.example.com in the same zone, enter _dmarc.marketing. More patterns are in DMARC record examples for common setups.
What are the Cloud DNS TXT quoting and 255-character rules?
Google's DNS records overview says each TXT string can be at most 255 characters and each TXT record at most 1,000 characters. For longer data, divide it into 255-byte strings and enclose each in quotation marks, such as "part one" "part two". A normal DMARC record fits in a single string.
- Quotes: a DMARC value contains spaces, and Google's JSON records format notes that strings with spaces must use the quoted form. Its SPF example is stored as
""v=spf1 include:_spf.google.com ~all""in JSON. - Splitting: receivers rejoin split strings. RFC 9989, Section 4.5, says the strings must be concatenated in order and parsed as one.
- Limit: the 1,000-character cap applies per TXT record. Google says to contact support if you need more, which a DMARC record never does.
- Plain text: paste from a text editor. Curly quotes from a word processor are not DNS quotes.
Splitting mostly matters for long DKIM keys, covered in DKIM key length: 1024 vs 2048.
How do you add the DMARC record with gcloud?
Run gcloud dns record-sets create with the full record name, --type=TXT, --ttl, --zone and the quoted value in --rrdatas. Wrap the double-quoted DMARC string in single quotes so the shell passes the double quotes through to Cloud DNS. Add --project when you manage more than one project.
gcloud dns record-sets create _dmarc.example.com.
--project=client-a-dns
--zone=example-com
--type=TXT
--ttl=300
--rrdatas='"v=DMARC1; p=none; rua=mailto:reports@example.net"'
The flags are documented in the gcloud dns record-sets create reference: DNS_NAME, --type and --zone (or -z) are required, and either --rrdatas or a routing policy must be given. --zone takes the zone's name in Cloud DNS, such as example-com, not the domain.
Read the record back before and after any change:
gcloud dns record-sets describe _dmarc.example.com.
--project=client-a-dns --zone=example-com --type=TXT
gcloud dns record-sets list
--project=client-a-dns --zone=example-com
--name=_dmarc.example.com. --type=TXT
How do you change the DMARC policy with gcloud?
Use gcloud dns record-sets update with the same name, type and zone, and the new value in --rrdatas. Cloud DNS allows only one record set per name and type, so a policy change is an update, not a second create. The values you pass define the record set's data, so include everything that should remain.
gcloud dns record-sets update _dmarc.example.com.
--project=client-a-dns
--zone=example-com
--type=TXT
--ttl=300
--rrdatas='"v=DMARC1; p=quarantine; rua=mailto:reports@example.net"'
The synopsis is in the gcloud dns record-sets update reference. For scripted changes across several records, Google also documents gcloud dns record-sets transaction start, add and execute on the records page.
Why does a comma in the rua tag break gcloud?
Because --rrdatas is a list flag, and gcloud splits list values on commas. RFC 9989, Section 4.6, separates multiple report URIs with commas, so rua=mailto:a@example.net,mailto:b@example.net becomes two TXT values. That publishes two broken DMARC strings, and receivers may discard both.
The fix is gcloud's alternate delimiter. Google's escaping topic says a list value that starts with ^DELIM^ is split on DELIM instead of commas. Pick a character that does not appear in the record, such as |:
gcloud dns record-sets update _dmarc.example.com.
--project=client-a-dns --zone=example-com --type=TXT --ttl=300
--rrdatas='^|^"v=DMARC1; p=none; rua=mailto:reports@example.net,mailto:soc@example.co.uk"'
On Windows cmd.exe or PowerShell, Google says each ^ must be escaped by repeating it. Always run describe afterwards and confirm one value comes back.
Which IAM roles can change a Cloud DNS DMARC record?
roles/dns.admin (DNS Administrator) grants read-write access to all Cloud DNS resources, including dns.resourceRecordSets.create and dns.resourceRecordSets.update. roles/dns.reader gives read-only access. Google's access control page also lists DNS Editor, DNS Viewer and DNS Peer.
| Role | ID | Use for DMARC work |
|---|---|---|
| DNS Administrator | roles/dns.admin |
Create and update _dmarc; ideally granted per zone, with a condition |
| DNS Editor | roles/dns.editor |
Edit DNS resources without managing IAM policies |
| DNS Reader | roles/dns.reader |
Audits and inventory across client projects |
| DNS Viewer | roles/dns.viewer |
Read-only access to DNS resources |
Cloud DNS supports IAM at project level and on individual zones. Google's guide to setting IAM policies for zones covers granting a role on one zone through Add principal in the console, or gcloud dns managed-zones set-iam-policy NAME --policy-file=POLICY-FILE.
The same guide describes IAM conditions that limit a binding to specific record sets. For DMARC, a condition in the style of Google's example would be:
resource.type == 'dns.googleapis.com/ResourceRecordSet' &&
resource.name.endsWith('/rrsets/_dmarc.example.com./TXT')
Google notes three catches. Resource names in conditions use the numeric managed zone ID, not the zone name. A restrictive condition also blocks listing record sets and describing the zone. And a principal with conditional access must add --skip-soa-update to transactions, because a transaction otherwise tries to update the SOA record.
What DMARC values should you publish under RFC 9989?
Start with p=none and a rua address, use the aggregate reports to fix every legitimate sender, then move to p=quarantine and p=reject as whole steps. RFC 9989 obsoletes RFC 7489 and removes the pct, ri and rf tags, so leave them out even if a template includes them.
| Stage | Value to publish |
|---|---|
| Monitoring | "v=DMARC1; p=none; rua=mailto:reports@example.net" |
| Cautious quarantine | "v=DMARC1; p=quarantine; t=y; rua=mailto:reports@example.net" |
| Quarantine | "v=DMARC1; p=quarantine; rua=mailto:reports@example.net" |
| Reject | "v=DMARC1; p=reject; rua=mailto:reports@example.net" |
| Non-sending domain | "v=DMARC1; p=reject; np=reject" |
The t=y test mode asks receivers to apply the policy one level lower, so p=quarantine; t=y is treated like p=none. Remove it once you are confident. np sets the policy for non-existent subdomains, explained in the np tag guide. The UK NCSC email security and anti-spoofing guidance describes the same path from monitoring to enforcement.
What if the domain sends through Google Workspace?
Add the record in Cloud DNS exactly as above; nothing changes in the Admin console. Google's Workspace DMARC setup page says to turn on SPF and DKIM first and wait at least 48 hours before adding DMARC. It recommends starting with p=none and always including rua.
Google's example record still includes the old percentage tag. Drop it: RFC 9989 removed it. The same example lists two rua addresses separated by a comma, which is exactly the case that needs the gcloud delimiter syntax above. The Workspace side is covered in DMARC and Google Workspace: setup guide and DMARCbis for Google Workspace clients.
Do external report addresses need extra DNS records?
Yes, when the rua address is on a different domain from the one publishing DMARC. RFC 9990, Section 4, says the report domain must publish a TXT record at <policy-domain>._report._dmarc.<report-domain> starting with v=DMARC1. Without it, receivers must ignore that rua address.
For example.com sending reports to reports@example.net, the example.net zone needs:
example.com._report._dmarc.example.net. TXT "v=DMARC1"
If example.net is also hosted in Cloud DNS, create it with the same gcloud dns record-sets create command in that zone's project. A report consumer that accepts reports for any domain can publish a wildcard, *._report._dmarc.example.net. Details are in authorising external DMARC report destinations.
How do you verify the DMARC record after publishing?
Query _dmarc from outside Google Cloud and confirm exactly one DMARC record comes back, with the value you intended. Then query one of the zone's own name servers directly to rule out resolver caching. Google says changes take time to reach resolvers, which keep cached answers until the old TTL expires.
$ dig +short TXT _dmarc.example.com
"v=DMARC1; p=none; rua=mailto:reports@example.net"
$ dig @ns-cloud-a1.googledomains.com +short TXT _dmarc.example.com
On Windows:
Resolve-DnsName -Name _dmarc.example.com -Type TXT
The DMARC checker validates syntax and flags duplicates, and how to check your DMARC policy explains the result. If a lookup says no record exists, work through how to fix "no DMARC record found".
How should MSPs manage DMARC across many Google Cloud projects?
Treat every client project as a separate DNS host. Pass --project on every command, grant your team a per-zone or conditional role instead of project-wide DNS Administrator, and keep an inventory of which project holds each delegated public zone. Most mistakes come from editing the right record in the wrong project.
- Inventory: for each client, record the project ID, zone name,
visibilityandnameServers, and compare the name servers with live NS records. - Explicit project: never rely on the active gcloud default project when a change touches client DNS. A wrong default writes a valid record into a zone that nobody queries.
- Least privilege: use
roles/dns.readerfor audits, and a zone-level binding with a_dmarccondition for changes. - Change records: save the
describeoutput before and after each update with the reason, so a rollback is one command. DMARC change management for MSP portfolios suggests a format. - Offboarding: remove your IAM bindings and any
ruaaddress you control when a client leaves. See tenant offboarding.
DMARC AI collects aggregate reports for every client domain in one multi-tenant view and classifies sending sources with AI, so you can see which senders align before moving a client to enforcement. More on running DMARC as a service is on DMARC for MSPs.
What should you check when the Cloud DNS DMARC record does not work?
Check delegation first, then zone visibility, then the number of values. Most failures come from editing an undelegated or private zone, an extra TXT value at _dmarc, or gcloud splitting a comma-separated rua list. The table lists common symptoms and fixes.
| Symptom | Likely cause | Fix |
|---|---|---|
Record visible in the console, public dig returns nothing |
Zone is not the one the registrar delegates to | Compare dig NS with Registrar setup; edit the delegated zone |
dig from a VM returns NXDOMAIN, public lookup works |
VPC authorised for a private zone with the same name | Test from outside Google Cloud |
| Record exists only in a private zone | Added to the split horizon zone | Create it in the public zone |
| Two TXT values returned, checker finds no valid policy | Extra item, or gcloud split the rua list on a comma |
Keep one value; use ^|^ delimiter syntax |
| Record not quoted or truncated | Missing quotes in --rrdatas |
Wrap as '"v=DMARC1; ..."' |
| Permission denied on update | Role missing dns.resourceRecordSets.update, or a condition blocks it |
Check the zone's IAM policy and condition |
| Old policy still returned | Resolvers caching the previous answer | Wait for the old TTL; query an ns-cloud- server |
| No aggregate reports arrive | No rua, or an external rua without authorisation |
Add rua; publish the RFC 9990 _report._dmarc record |
Frequently asked questions
What DNS name do I enter for DMARC in Google Cloud DNS?
Enter _dmarc in the DNS name field of the domain's public zone. The console appends the zone name and the trailing dot, so the record becomes _dmarc.example.com.. In gcloud, give the full name with its trailing dot, _dmarc.example.com., as the first argument to gcloud dns record-sets create.
Do I need quotes around the DMARC value in Cloud DNS?
Yes. Google's TXT examples enclose each string in quotation marks, and a value with spaces must use the quoted form. In the console, type "v=DMARC1; p=none; rua=mailto:...". On the command line, wrap that in single quotes so the shell passes the double quotes to gcloud unchanged.
Can I put the DMARC record in a private Cloud DNS zone?
You can create it, but receivers will never see it. A private zone can only be queried by the VPC networks you authorise. Mail receivers query public DNS, so the record must be in the public zone whose ns-cloud- name servers are listed at the registrar.
Which IAM role do I need to add a DMARC record?
A role with dns.resourceRecordSets.create and dns.resourceRecordSets.update on the zone, such as roles/dns.admin. Google supports granting it on a single zone, and adding an IAM condition that restricts the binding to _dmarc TXT record sets. Use roles/dns.reader for read-only audits across client projects.
How long does a Cloud DNS DMARC change take to work?
Google does not give a fixed figure. Its documentation says changes take time to propagate depending on the TTL of the records, because resolvers keep cached answers until the TTL expires. Use a short TTL such as 300 seconds while changing policy, and query an ns-cloud- name server to see the authoritative answer.
Next steps
Adding a DMARC record in Google Cloud DNS takes one command or one form. The care goes into the checks around it: confirm the delegated public zone and its project, quote the value, keep a single _dmarc value, watch for commas in --rrdatas, and scope IAM to the zone. Then let aggregate reports decide when each client moves from p=none to p=reject.