DNS authorizations let you prove ownership of domains for Google-managed certificates. When creating a Google-managed certificate, one or more DNS authorizations can be specified to use for provisioning and renewal.
This page describes how to create and manage DNS authorizations for use with Google-managed certificates.
For more information, see Domain authorizations.
Create a DNS authorization
A DNS authorization only covers a single domain name. You must create a separate DNS authorization for each domain name that you want to use with the target certificate.
If you're creating a
DNS authorization for a wildcard certificate, such as *.myorg.example.com,
configure the DNS authorization for the parent domain—for example,
myorg.example.com.
To independently manage certificates across multiple projects, you can use
PER_PROJECT_RECORD DNS authorization.
Certificate Manager can handle issuing and managing certificates
for each project independently within Google Cloud. DNS authorizations and
certificates that you use within a project are self-contained and don't interact
with those in other projects.
Console
You can create a DNS authorization or attach an existing DNS authorization when creating a certificate. For more information, see Create a Google-managed certificate referencing the DNS authorization.
gcloud
Depending on your requirements, you can create any of these two types of DNS
authorizations: FIXED_RECORD or PER_PROJECT_RECORD. For more
information, see DNS authorization.
FIXED_RECORD DNS authorization
To create a FIXED_RECORD DNS authorization, use the following gcloud certificate-manager
dns-authorizations create command:
gcloud certificate-manager dns-authorizations create AUTHORIZATION_NAME \
--domain="DOMAIN_NAME" \
--type=[FIXED_RECORD] \
[--location="LOCATION"]
Replace the following:
AUTHORIZATION_NAME: the name of the DNS authorization.DOMAIN_NAME: the name of the target domain for which you are creating this DNS authorization. The domain name must be a fully qualified domain name, such asmyorg.example.com.LOCATION: the target Google Cloud location where you create the DNS authorization.
After creating the FIXED_RECORD DNS authorization, verify it with the
gcloud certificate-manager dns-authorizations describe command:
gcloud certificate-manager dns-authorizations describe AUTHORIZATION_NAME
The output is similar to the following. In the output, find the
dnsResourceRecord line and get the CNAME record (data,name, and type)
to add to your DNS
configuration.
createTime: '2022-01-14T13:35:00.258409106Z' dnsResourceRecord: data: 0e40fc77-a37d-4eb8-8fe1-eea2e18d12d9.4.authorize.certificatemanager.goog. name: _acme-challenge.myorg.example.com. type: CNAME domain: myorg.example.com name: projects/myProject/locations/global/dnsAuthorizations/myAuthorization updateTime: '2022-01-14T13:35:01.571086137Z'
PER_PROJECT_RECORD DNS authorization
To create a PER_PROJECT_RECORD DNS authorization, use the following
gcloud certificate-manager dns-authorizations create command:
gcloud certificate-manager dns-authorizations create AUTHORIZATION_NAME \
--domain="DOMAIN_NAME" \
--type=PER_PROJECT_RECORD \
[--location="LOCATION"]
Replace the following:
AUTHORIZATION_NAME: the name of the DNS authorization.DOMAIN_NAME: the name of the target domain for which you are creating this DNS authorization. The domain name must be a fully qualified domain name, such asmyorg.example.com.LOCATION: the target Google Cloud location where you create the DNS authorization.
After creating the PER_PROJECT_RECORD DNS authorization, verify it with
the gcloud certificate-manager dns-authorizations describe command:
gcloud certificate-manager dns-authorizations describe AUTHORIZATION_NAME
The output is similar to the following. In the output, find the
dnsResourceRecord section. Locate the CNAME record and add the record's
details (data,name, and type) to your DNS configuration.
createTime: '2022-01-14T13:35:00.258409106Z' dnsResourceRecord: data: 0e40fc77-a37d-4eb8-8fe1-eea2e18d12d9.4.authorize.certificatemanager.goog. name: _acme-challenge_ujmmovf2vn55tgye.myorg.example.com type: CNAME domain: myorg.example.com name: projects/myProject/locations/global/dnsAuthorizations/myAuthorization updateTime: '2022-01-14T13:35:01.571086137Z'
Terraform
To create a DNS authorization, you can use a
google_certificate_manager_dns_authorization resource.
To learn how to apply or remove a Terraform configuration, see Basic Terraform commands.
API
To create a DNS authorization, make a POST request to the dnsAuthorizations.create method:
POST /v1/projects/PROJECT_ID/locations/LOCATION/dnsAuthorizations?dns_authorization_id=AUTHORIZATION_NAME
{
"domain": "DOMAIN_NAME",
"type": "PER_PROJECT_RECORD" //optional
}
Replace the following:
PROJECT_ID: ID of your Google Cloud project.LOCATION: the target Google Cloud location where you create the DNS authorization. For the global location, useglobal.AUTHORIZATION_NAME: the name of the DNS authorization.DOMAIN_NAME: the name of the target domain for which you are creating this DNS authorization. The domain name must be a fully qualified domain name, such asmyorg.example.com.
Add the CNAME record to your DNS configuration
If you're using a third-party DNS solution to manage your DNS, refer to its documentation to add the CNAME record to the DNS configuration. If you're using Google Cloud to manage your DNS, complete the steps in this section.
Console
To create a record set, follow these steps:
In the Google Cloud console, go to the DNS zones page.
Click the name of the DNS zone where you want to add the record.
On the Zone details page, click Add standard.
On the Create record set page, in the DNS name field, enter the subdomain of the DNS zone.
When entering the subdomain name, make sure that the subdomain name, including the greyed-out text displayed in the DNS name field, matches the full value of the
dnsResourceRecord.namefield as displayed in the output of thegcloud certificate-manager dns-authorizations describecommand.See the following examples:
If the
dnsResourceRecord.namefield value is_acme-challenge.myorg.example.com., and the greyed-out text in the DNS name field is.example.com., then enter_acme-challenge.myorg.If the
dnsResourceRecord.namefield value is_acme-challenge.myorg.example.com., and the greyed-out text in the DNS name field is.myorg.example.com., then enter_acme-challenge.If the value of the
dnsResourceRecord.namefield is_acme-challenge_ujmmovf2vn55tgye.myorg.example.com., and the greyed-out text in the DNS name field is.myorg.example.com., then enter_acme-challenge_ujmmovf2vn55tgye.
In the Resource record type field, select CNAME.
In the TTL field, enter a positive numeric value for the resource record's time to live, which is the amount of time that it can be cached.
From the TTL unit list, select the unit of time—for example,
30 minutes.In the Canonical name field, enter the full value of the
dnsResourceRecord.datafield as displayed in the output of thegcloud certificate-manager dns-authorizations describecommand.To enter additional information, click Add item.
Click Create.
gcloud
When you create a DNS authorization, the gcloud CLI command returns the corresponding CNAME record. To add the CNAME record to your DNS configuration in the DNS zone of the target domain, follow these steps:
Initiate the DNS record transaction:
gcloud dns record-sets transaction start --zone="DNS_ZONE_NAME"
Replace
DNS_ZONE_NAMEwith the name of the target DNS zone.Add the CNAME record to the target DNS zone:
gcloud dns record-sets transaction add CNAME_RECORD \ --name="VALIDATION_SUBDOMAIN_NAME.DOMAIN_NAME." \ --ttl="30" \ --type="CNAME" \ --zone="DNS_ZONE_NAME"Replace the following:
CNAME_RECORD: the full data value of the CNAME record returned by the Google Cloud CLI command that created the corresponding DNS authorization.VALIDATION_SUBDOMAIN_NAME: the prefix subdomain of the DNS zone, such as_acme-challenge. You can copy the name from thegcloud certificate-manager dns-authorizations describecommand log, as described in Create a DNS authorization.DOMAIN_NAME: the name of the target domain.The domain name must be a fully qualified domain name, such asmyorg.example.com. You must also include the trailing period after the target domain name.DNS_ZONE_NAME: the name of the target DNS zone.
For more information about the difference between