Thursday, July 5, 2018

Static website hosting for Azure Storage

The public preview of static website hosting for Azure Storage has released on June 28, 2018!
The newly released feature set is available in all public cloud regions with support in government and sovereign clouds coming soon.These new feature enable a cost-effective and scalable solution for hosting integrated modern web applications on Azure.

Usually on a static website, webpages contain static content and JavaScript or other client-side code.But when it comes to dynamic websites, it depends on server-side code, and can be hosted using Azure Web Apps.
But now a day’s deployments shift toward elastic, cost-effective models, the ability to deliver web content without the need for server management is critical.
As Azure introduces static website hosting in Azure Storage makes this possible. This will enable rich backend capabilities with server less architectures with Azure Functions and other Paas (Platform as a Service) Services.

By enabling  static websites on storage account, a new web service endpoint is created as follow


Getting started
·      Supporting Platforms
Net Client Library (version 9.3.0), Java Client Library (version 8.0.0), Python Client Library (version 1.3.0), Node.js Client Library (version 2.10.0), Visual Studio Code Extension (version 0.4.0), and CLI 2.0 (extension version 0.1.3).
Storage Explorer and Powershell support will be available soon.
Storage Services REST API is available now.
Static websites is supported by REST API version 2018-03-28 and greater (Azure recommended using the latest always)

·      How to Access
1.     Create a GPv2 Storage Account on Azure

2.     Click On the Newly Created Storage and you will see a link on settings section in the left navigation bar and Enable it.

3.     Upload web assets to $web Container. (Created when Static website enabled)

To do this you can directly access azure portal or can take advantage of the Visual Studio Code Extension to upload entire directory structures.
Visual Studio Code:
Right click on the $web container, select Deploy to static website and find the directory you want to upload
Make sure to include an index document with the name you configured. In this example, the document's name is index.html.

The web service endpoint always allows anonymous read access, returns formatted HTML pages in response to service errors, and allows only object read operations. The web service endpoint returns the index document in the requested directory for both the root and all subdirectories. When the storage service returns a 404 error, the web endpoint returns a custom error document if you configured it.

Volla! Go to your primary endpoint and test your site.

No comments:

Post a Comment