Azure Static Website Hosting - azure

Is there any way to host static website (HTML + CSS + JS) in Azure? Like we do Amazon S3 Static Website hosting, they charge only for storage.

UPDATE: 29-June-2018
It is now possible to host static websites in Azure Storage. You can read more about it here: https://learn.microsoft.com/en-gb/azure/storage/blobs/storage-blob-static-website
As of today, no. Azure doesn't have an equivalent of that. You can however host static sites as Web Apps and for free as well if you're comfortable with the restrictions with free tier.

It's not officially supported, but if you hosted your site in Azure Blob Storage's root container and made the container publicly accessible, you could probably achieve the same affect. You can even give the blob storage account a custom domain name.
Only downside is that you'll have to figure out a good deployment story. Two of your options are to use an FTP-like client such as CloudBerry to manually deploy your site, or write your own deployment script using the blob storage api

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 http://info.mydomainname.com/docs/index.html
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.
I have asked if there is a work around here

Related

Single domain for Azure Blob and Servcice App

I have a blog on WordPress, which I have converted into ASP.NET Core. I am using Azure Service App. As it's a blog, so it has a lot of images, around 4GB of images. For now, I have placed these images in the wwwroot folder. Now I want to transfer them to Blob storage.
But problem is that, when I add images in Blob, I get a different link. I have used Azure CDN and have tried custom domain. But here the issue comes is:
My Service App is running at www..com
I am able to redirect my Blob CDN to images..com .... I have added it in the DNS record
But what I want is to use the same domain www..com for both Blob and Service App, which I tried my best but couldn't achieve. The main reason is I couldn't add multiple CNAME for www.
Why I can't change the link, coz it will affect my blog's SEO, so I can't take that risk. Need help.
Thanks in advance.
what I want is to use the same domain www..com for both Blob and Service App
This is not possible you can use sub-domain on your CDN Endpoint and main domain on service app.
Create CDN.
Add custom sub-domain on CDN Endpoints. For example :- if your domain www.abc.com then you can use cdn.abc.com, image.abc.com, photo.abc.com etc.
More information about Add Cutom Domain on CDN read these Microsoft document.
SO thread on same issue It is not possible to provision same domain for different service

Azure Blob DNS Redirect from CPANEL

I got a website hosted in go daddy. The domain is using CPANEL.
Made a new Azure Blob Storage with another part of the website.
My current domain is www.mydomain.com, I added a new redirect from market.mydomain.com to Azure Blob. It works.
The problem is that when the redirection happens, the URL changes to azure's blob URL. What im trying to do here is to keep the DNS name pointing to Azure BLOB.
Channel seems to offer no access to CNAME configuration tho.
That is something that could be done in other providers using httaccess. Azure Blob has its own syntax, could not figure out examples on what should be configured to make this work.
What is the default configuration for Azure Blobs to handle redirections keeping the url ?
Thanks !

Static website at root domain hosted over a Blob Storage on Azure?

I would like to host a static website over the Blob Storage of Microsoft Azure. Is it possible to have the website hosted at the root of the domain (aka http://contoso.com rather than http://www.contoso.com) while using the Blob Storage?
Custom domain mapping to an Azure Blob Storage static website works only for subdomains (for example: www.contoso.com).
If you want your web endpoint to be available on the root domain (for example: contoso.com), then you'll have to use Azure CDN Map a custom domain with HTTPS enabled or Azure Static Web Apps.
https://learn.microsoft.com/en-us/azure/storage/blobs/storage-custom-domain-name?tabs=azure-portal#map-a-custom-domain-with-https-enabled

Hosting multiple static websites on Azure Blob Storage

I currently host a static web app on Azure Blob Storage which uses an SSL cert that I have on Azure Key Vault -- see picture below.
My question is hosting second and third static web apps -- which will also have their own SSL certs coming from Azure Key Vault. Do I need separate storage accounts for each static website I want to host on Azure Blob Storage?
All the files come from $web container and I'm not sure if there's a way to pull web site content from another container on Azure Blob Storage.
Do I need separate storage accounts for each static website I want to host on Azure Blob Storage
Yes, you would need to add new storage accounts and create custom domains and SSL certs for each account.
That's why I would propose a different solution:
Use one Azure Front Door, add one (or multiple, if you need to) custom domains to it. Either reference your custom SSL cert from KeyVault or - even better - use the FrontDoor-managed certificates. Then create one storage account and create a new container for each web site you want to host. You dont even need to enable static website for this to work if you just make the containers public-read.
Then add the storage account as a backend in Front Door and different routing rules to the different containers. The routing rules could either be based on the path or, if you add different domain names for each site to Front Door, based on the domain.

Azure Cloud Service and Amazon Cloudfront Inter-Operability

From what I’ve been told by the Azure support staff, the Azure CDN is at best deprecated at the moment while they work out the details of a new service they are supposed to roll out eventually. For that reason and because the particular site I am building requires the content to secured (It’s going to be paid for) I need to look somewhere else for a CDN since the current Azure offering doesn’t offer that possibility.
I was thinking of using Cloudfront but the dilemma I’m having is where to store my files. I cannot seem to find anything online about inter-operability between Azure and Cloudfront (using either Cloudfront with Azure Blob Storage, or an Azure Web Worker and S3/Cloudfront for file storage and CDN).
Does anybody have any experience, tips, pointers, or gotchas on doing this? Or perhaps a recommend another service I can use?
To point your CloudFront CDN to your Azure Blob storage you will need to set up a managed custom domain on your Azure storage service and point your CloudFront CDN origin domain name to this custom domain.
Steps:
Create a CNAME entry for your domain to point to your blob storage (eg CNAME blob.mydomain.com to myservice.blob.core.windows.net)
Add a managed custom domain to your Azure storage account: blob.mydomain.com
Create a CloudFront CDN distribution with origin server blob.mydomain.com
Use your CloudFront CDN url to access your resources eg: http://acbdefgh.cloudfront.net/users/john
Alternatively set up a CNAME to point to your CloudFront CDN domain. Eg avatar.mydomain.com to acbdefgh.cloudfront.net and update your CloudFront distribution CNAME with avatar.mydomain.com
The ability to invalidate cached objects is a good example of why you might want to use Amazon's CloudFront CDN over the Azure CDN. Using the steps above you could for example use CloudFront to cached objects that occasionally need to be invalidated (such as profile pics - avatar.mydomain.com) and the Azure CDN for everything else (blob.mydomain.com) where both sub domains point to the same azure blob storage account myservice.blob.core.windows.net.

Resources