Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure a custom domain name for an azure blob storage endpoint

I am following these instructions on how to configure a custom domain for a blob storage endpoint

and get to the instruction on configuring the custom domain name

Azure shows

this screen

I expect I need to enter the custom domain name but I am not clear on how to do this.

For example which one?

contoso.com
www.contoso.com
http://www.contoso.com
http://contoso.com 

I am trying contoso.com

When I do this I see a brief message stating

Failed to update storage account 'mystaticwebsite' Error: The custom domain name could not be verified. CName mapping from contoso.com to mywebsite.blob.core.windows.net does not exist
  • using my example names

I have only just changed my domain name hosting location so I expect I need to wait.

[Update] I see that all my storage accounts belong to the same Active Directory. Could it be that the website needs to have the same domain as the Azure Active Directory?

[Update] I see the CName record is not propagating. I have asked about it here

like image 639
Kirsten Avatar asked Dec 28 '17 22:12

Kirsten


People also ask

Can you create a custom domain name in Azure?

After you create your directory, you can add your custom domain name. Sign in to the Azure portal using a Global administrator account for the directory. Search for and select Azure Active Directory from any page. Then select Custom domain names > Add custom domain.

What is custom domain in Azure storage account?

A custom domain for accessing blob data in an Azure storage account can be mapped to either the blob storage endpoint (<your-storage-account-name>. blob.core.windows.net) or the web endpoint (<your-storage-account-name>.


2 Answers

I noticed existing answers are over a year old. Here is my scenario and the simple change I needed:

  1. I already had my domain/website running through Cloudflare for the past 5+ years. My simple static .html website was being hosted on a traditional IIS server, but Azure's Static website offering is much more attractive, so now I was trying to move everything over as an Azure static website.
  2. I created a new Storage Account and set up the "Static website" and copied my files over via Azure Storage Explorer.
  3. My static website was working over Azure's url -- https xxxxxx.z5.web.core.windows.net fine.
  4. I went to the "Custom domain" settings in the Blob service section of my Storage Account and followed the instructions of adding a CNAME for example.com and www in Cloudflare's DNS settings dashboard.
  5. Back in the Azure Portal, I typed www.example.com into the custom domain textbox, but was immediately notified of:

    "Failed to update storage account 'xxxxxxx'. Error: The custom domain name could not be verified. CNAME mapping from www.example.com to any of xxxxx.windows.net, xxxxx.core.windows does not exist."

  6. But I already followed the CNAME instructions and my Cloudflare DNS entries looked exactly like they wanted. I waited hours, thinking it was a DNS replication/refresh issue. I went to bed. Same problem in the morning.

  7. THEN I noticed one thing that was different in Cloudflare... All 3 of the CNAMES i set up (asverify.www, example.com and www) all had Status "DNS and HTTP proxy (CDN)" turned on (the cloud icon with an arrow through it was lit up and orange colored.)
  8. I clicked each one to turn off HTTP proxy. So now my DNS entries at Cloudflare are "DNS only" <-- this is the tl;dr, thanks for reading all this way.

tl;dr: If your DNS Records are set up in Cloudflare, you must make each of those entries "DNS only" and not "DNS and HTTP proxy (CDN)"

Edit: After your custom domain name is verified, you can go back into Cloudflare and turn the HTTP proxy (CDN) back on. You will need to add a Page Rule of example.com/* to Forwarding URL 301 to https://www.example.com/$1 if you want SSL to work for a root site.

like image 54
Dean L Avatar answered Sep 29 '22 22:09

Dean L


As your first link mentioned, you need to get a custom domain name which binds your blob storage endpoint url before you enter the domain name in textbox.( step 3, 4, 5 ). If you enter the domain name casually, you would get the above error. And you needn’t to enter ‘http://’ in textbox. The ‘contoso.com’ and ‘www.contoso,com’ are OK.

If you have a custom domain name, you just need to create a CNAME record with your DNS provider that points from your domain (like www.contoso.com) to blob endpoint url. Different domain registrar's websites have different methods.

For Azure,you could follow my steps to bind a domain name to blob endpoint url:

  1. Before you do this, please make sure you have purchased a valid domain name. If not, please refer to this step to buy: (App Service>Create App service>click Custom domains> Buy domain). Or you could read this article to buy a domain name. Buy domain
    If you have already purchased it, you could see the custom domain name like this: the domain name you have purchased

  2. Open your App Service>Custom domains>App Service Domains(domain name list)> click your domain name>Click DNS Zone>click ‘+Record set’ button. Record set

  3. In Name property, you could enter a custom domain name( such as aa.contoso.com). In Type, you could choose CNAME. In Alias, you could enter your blob storage endpoint url which you want to bind( such as myname.blob.core.windows.net). After you saved the record, you’d better to click ‘Refresh’ button to refresh the domain record list. The bind screenshot like this: Bind blob endpoint url to custom domain name
  4. Return storage account> Blob Service>Custom domain>In textbox, you could enter the custom domain name which you have created. (such as aa.contoso.com).
  5. Finally, you could save the domain name successfully. (If you saved successfully, the ‘Save’ button would be disabled.) save custom domain name successfully
like image 22
Janley Zhang Avatar answered Sep 29 '22 22:09

Janley Zhang