By the definition, the static website contains web pages with fixed content and displays the same content to every user on every visit, and static websites are very basic and easy to create.
Now static websites can be built using HTML, CSS and JavaScript and hosted on Azure Storage, and support client-side script execution but not server-side, if the static website needs some data processing or manipulation on server-side you can leverage it to Azure Cognitive Services or Azure Functions.
Static websites are very useful when it doesn’t require high bandwidth, backend support and targeted to limited audiences and mostly for the shorter duration of time.
Explain about the project and the road map.
Showcase about the products, events and promotions.
Technical Documents & Manuals
When the static website service is enabled on a Azure storage account you need to enter the default document name; and error document name as optional and when the feature is enabled a container named $web
will be created if it doesn’t already exist to upload your website files. Files in the $web container are read only, case sensitive and available to access anonymously
…
Available to the public web following this pattern:
https://<ACCOUNT_NAME>.<ZONE_NAME>.web.core.windows.net/<FILE_NAME>
Available through a Blob storage endpoint following this pattern:
https://<ACCOUNT_NAME>.blob.core.windows.net/$web/<FILE_NAME>
It can also available with CDN and SSL support and custom domain name as well.
Azure Static website feature is free; the pricing is only for storage. But in addition to the storage costs, data egress will apply and in case Azure CDN is enabled to use a custom domain with an SSL certificate, that will also be applicable.
All you need is a valid Azure subscription and follow the steps (in PowerShell)…
#requires -Module Az
## Ensure logged into your Azure account
if([string]::IsNullOrEmpty($(Get-AzContext)))
{ Add-AzAccount }
## Define the required variables
$SubscriptionId = '<SubscriptionId>' # This is your subscription id (ex: 'f34d6539-c45b-4a93-91d9-0b4e6ffb6030')
$ResourceGroupName = 'static-websites-rg' # Resource Group
$Location = 'southindia' # Location
$StorageAccountName = 'staticwebsitesa999' # Storage Account
$WebpagePath = "C:\wwwroot\" # Static website files
## Select the required subscription, in case there multiple subscriptions
Select-AzSubscription -Subscription $SubscriptionId
## Select/Create Azure resource group
# Parameters
$ParamList = @{
Name = $ResourceGroupName
Location= $Location
}
# Create the resource group if it doesn't exist
$ResourceGroup = Get-AzResourceGroup @ParamList -ErrorAction SilentlyContinue
if ($null -eq $ResourceGroup) { New-AzResourceGroup @ParamList }
## Select/Create storage account
# Parameters
$ParamTable = @{
Name = $StorageAccountName
ResourceGroupName = $ResourceGroupName
}
# Create the storage account if it doesn't exist
$StorageAccount = Get-AzStorageAccount @ParamTable -ErrorAction SilentlyContinue
if ($null -eq $StorageAccount)
{
$ParamTable.Location = $Location
$ParamTable.SkuName = 'Standard_LRS'
$ParamTable.Kind = 'StorageV2'
$ParamTable.AccessTier = 'Hot'
New-AzStorageAccount @ParamTable
}
## Parameters required to use with storage Cmdlets
$ParamTable = @{
Name = $StorageAccountName
ResourceGroupName = $ResourceGroupName
}
## Set the storage account to enable the static website feature
Set-AzCurrentStorageAccount @ParamTable
## Enable the static website feature for the selected storage account
# Ensure the documents are created with the names mentioned
Enable-AzStorageStaticWebsite -IndexDocument "index.html" -ErrorDocument404Path "error.html"
## Upload the website pages to the azure blob container
Get-ChildItem -Path $WebpagePath -Recurse | Set-AzStorageBlobContent -Container '$web'
## Verify the files uploaded to the azure blob container
Get-AzStorageContainer -Name '$web' | Get-AzStorageBlob
## Retrieve the public URL to access the static website
(Get-AzStorageAccount @ParamTable).PrimaryEndpoints.Web
## Add custom domain to your static website, but need to add CNAME record in your domain dns server
Set-AzStorageAccount @ParamTable -CustomDomainName "www.yourdomain.com" -UseSubDomain $True
With the glory of GitHub public repositories, I have cloned a simple website and created my profile page just like that and hosted it on my Azure Storage.