Deploy Your First Website with Azure CLI, Step by Step
Azure·October 16, 2026·5 min read

Deploy Your First Website with Azure CLI, Step by Step

Azure CLI is the fastest way to get something real deployed. Quicker than clicking through the portal, and less ceremony than a template when you are still finding your feet.

By the end of this you will have a static website live on the internet with a public URL, created entirely from the command line, in five commands.

What you need

  • An Azure account. The free tier is enough for this. If you are comparing what the providers give away, we break down the equivalent on the other side in understanding the AWS free tier.
  • Azure CLI installed locally, or Cloud Shell in the browser.
  • An HTML file. One will do.

No local install needed

If you would rather not install anything, open Cloud Shell at shell.azure.com. The CLI is already there and already authenticated as you.

Step 1: Create a resource group

Everything in Azure lives inside a resource group. Think of it as a folder that also has opinions about billing and lifecycle.

az group create --name website-rg --location canadacentral

Pick a region near your users. canadacentral, eastus and westeurope are all reasonable defaults.

Why the resource group matters more than it looks

It is not only organisational. It is a billing boundary and a lifecycle boundary. Deleting the group deletes everything inside it, which is what makes cleanup at the end a single command instead of a hunt.

Step 2: Create a storage account

Blob Storage has static website hosting built in, which is the simplest path for this.

az storage account create \
  --name mywebsitestorage123 \
  --resource-group website-rg \
  --location canadacentral \
  --sku Standard_LRS \
  --kind StorageV2

Storage account names are globally unique across all of Azure, lowercase only, 3 to 24 characters. If yours is taken, add digits until it is not.

Step 3: Turn on static website hosting

az storage blob service-properties update \
  --account-name mywebsitestorage123 \
  --static-website \
  --index-document index.html \
  --404-document 404.html

This tells the account to serve files out of a special $web container as a website, and which file to serve at the root.

Step 4: Upload your files

If you do not have one already, this is enough:

<!DOCTYPE html>
<html>
<head><title>My First Azure Website</title></head>
<body>
  <h1>Deployed with Azure CLI</h1>
  <p>This site is hosted on Azure Blob Storage.</p>
</body>
</html>

Then push it up:

az storage blob upload-batch \
  --account-name mywebsitestorage123 \
  --source . \
  --destination '$web' \
  --overwrite

Step 5: Find your URL

az storage account show \
  --name mywebsitestorage123 \
  --resource-group website-rg \
  --query "primaryEndpoints.web" \
  --output tsv

You get back something like https://mywebsitestorage123.z13.web.core.windows.net/. Open it. That is your site.

Five commands, one live website

No server to configure, no pipeline to wire up, no infrastructure to keep running. This is the shortest useful thing you can build in Azure.

What actually happened

Enabling static hosting created a $web container with public read access. Anything you put in it is served over HTTPS.

The storage account is quietly handling three things for you. HTTPS works immediately, using Azure's certificate for the default domain. Traffic spikes need no configuration, because Blob Storage was already built to absorb them. And Standard_LRS keeps three copies of your data within the region, so a single hardware failure is not your problem.

For a production site you would add a custom domain and put a CDN in front. For learning and prototyping the default endpoint is genuinely fine.

Do it yourself

Reading commands teaches you the shape. Typing them teaches you the details, particularly the ones that only appear when something is not quite right.

The same deployment runs as a guided lab in a real Azure sandbox, with checks confirming each step actually worked. You can work through deploying your first website end to end.

Once that clicks, the CLI itself is worth learning properly rather than copying command by command. Azure CLI essentials covers the core resource management operations you will use constantly.

Clean up

One command removes all of it:

az group delete --name website-rg --yes --no-wait

Because everything went into a single resource group, this takes the storage account and the website with it. Nothing is left behind quietly costing you money, which is the habit worth forming early.

Where to go next

Make it repeatable. The commands above are fine once. When you need the same environment again next month, you want it described in a file rather than in your shell history. Write and deploy your first Bicep template is the natural next step.

Go deeper on storage. Static hosting is one small corner of it. Managing blob storage operations with the CLI covers the operations you will actually reach for.

Certification. CLI fluency is tested throughout AZ-104, and it is one of the areas where practical experience shows up most clearly in scenario questions.