I found a way to host a static website in an Azure blob, using a subdomain and an http re-direct

I do the following

1) In Azure I create a storage account with a container ( called docs ) that has Blob access policy.

2) I upload my static website to the docs container using the storage explorer. This includes some PHP files in a sub folder.

3) In the DNS I set up a cname record for a subdomain ( called info say) with alias myblob.blob.core.windows.net ( where myblob is the name of my blob)

4) In the DNS I create an Http redirect for record to a file on the subdomain for www with url xhttp://info.mydomainname.com/docs/index.html ( spelt without the x. I put an x in front to prevent the hyperlink )

5) In Azure I create a custom domain for info.mydomainname.com

My website then works however if someone knows the location of the PHP files then they can download them which means I must not store secrets in them.

Is there a way I can prevent them from being accessed?

I am using a Blob access policy for my container

  • Or should this be a Stack Overflow question? – kirsten g Jan 6 '18 at 1:35
  • 1
    Why are the PHP files in there in the first place? Blob storage will only serve static content, so it won't do anything with them anyway other than offer them up as static files. Why not just remove them? – Sam Cogan Jan 8 '18 at 9:17

Reading the documentation I don't think it can be done.
As Sam points out they should not be there anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.