Do you know how to create a custom domain name with azure command line?

1.9k views Asked by At

https://learn.microsoft.com/en-us/cli/azure/?view=azure-cli-latest

1.Resource Group                        |  az group create -l westeurope -n Domains

2.CDN > profile  > create               |  az cdn profile create -g Domains -n HomeProfile --sku Premium_Verizon

3.CDN > endpoint > create               |  az cdn endpoint create -g Domains -n HomeEndpoint --profile-name HomeProfile --origin www.home1991-2000.com

4.DNS > Zones > create                  |  az network dns zone create -g Domains -n www.home1991-2000.com

5.DNS > Record sets > CNAME > create    |  az network dns record-set cname create -g Domains -z www.home1991-2000.com -n HomeRecordSet
 
6.eventgrid > domain > create           |  az eventgrid domain create -g Domains --name home1991-2000 -l westeurope

7.CDN > custom-domain > create          |  az cdn custom-domain create -g Domains --endpoint-name HomeEndpoint --profile-name HomeProfile -n home1991-2000-name --hostname www.home1991-2000.com

I'm receive these bad request. Can anyone help ?

BadRequest - We couldn't find a DNS record for custom domain that points to endpoint. To map a domain to this endpoint, create a CNAME record with your DNS provider for custom domain that points to endpoint.

1

There are 1 answers

0
Bhargavi Annadevara On

Quoting the official docs:

Before you can use a custom domain with an Azure CDN endpoint, you must first create a canonical name (CNAME) record with your domain provider to point to your CDN endpoint. A CNAME record is a type of DNS record that maps a source domain name to a destination domain name. For Azure CDN, the source domain name is your custom domain name and the destination domain name is your CDN endpoint hostname. After Azure CDN verifies the CNAME record that you create, traffic addressed to the source custom domain (such as www.contoso.com) is routed to the specified destination CDN endpoint hostname (such as contoso.azureedge.net).

Therefore, as the error message points out, you will need to create a CNAME record with your DNS provider for your custom domain that points to your CDN endpoint, i.e., HomeEndpoint.azureedge.net.

As a pre-req, in order to use Azure DNS for your custom domain, you must first delegate your domain to Azure DNS. If you do not already have a custom domain, you must first purchase one with a domain provider.

Once this is done, you can associate the custom domain with your CDN endpoint.

Note: The az network dns record-set cname create command only creates an empty CNAME record set. You might want to use az network dns record-set cname set-record instead to actually also set the value of a CNAME record.

References: