- Create a certificate-signed RDP shortcut via Group Policy - Fri, Aug 9 2019
- Monitor web server uptime with a PowerShell script - Tue, Aug 6 2019
- How to build a PowerShell inventory script for Windows Servers - Fri, Aug 2 2019
To create and host a static website in Azure, the first thing we need to do is go to the Azure portal and create a new storage account. Click on Storage Accounts on the left-hand side, click on Add at the top, and fill in the form. We'll give it a Name and select the Account kind of StorageV2.
Scroll down to the bottom, give it a Resource group, and click on Create. Once the deployment has succeeded, we can click on Refresh, and we should see our storage account appear in the list.
Click into that and scroll down very slightly on the settings. We should see Static website (preview) in the list. We'll click on that and then click on Enabled.
Now we need to define the index document name and click on Save.
The last thing we need to do is go up to Storage Explorer, and we should see we've got a $web container already pre-created for us. This is where we need to upload our file.
Now we can find our index.html file and click on Upload. Once it's done uploading, you'll see it in the list below.
If we now go back to the Static Website section, copy/paste the Primary endpoint URL, and browse to it, we should see our super simple website displaying our index.html file.
However, this is just on an Azure-provided windows.net domain name. If we like, we can also create a custom domain name for our website. To do this, we can go to our DNS registrar, add in a CNAME for blog or whatever name you choose, and point this at our hosted website. The process to do this will be different depending on the DNS registrar you have.
Once we've done this, we'll head back over to our storage account, scroll down again in the settings, and find the Custom Domain option. Once we find this, we'll need to enter the custom domain we just created and then click on Save.
At this point, we can then open up a browser again, enter our new URL, and we should now see the contents of our index.html file showing up!
Static websites in Azure are a convenient way of displaying one or more web pages quickly and easily. There's no need for a web server or even a website for that matter! The only thing you need is an Azure storage account and one or more HTML files!