Azure – CLI – Create Website in Azure Cloud Shell

email me

Azure Cloud Shell?

Create Website

From Cloud Shell, run this az vm extension set command to download and execute a PowerShell script that installs IIS and configures a basic home page.

az vm extension set \
--resource-group 79fdb1a1-c11e-4716-8a08-f9c4d710ed47 \
--vm-name myVM \
--name CustomScriptExtension \
--publisher Microsoft.Compute \
--settings '{"fileUris":[""]}' \
--protected-settings '{"commandToExecute": "powershell -ExecutionPolicy Unrestricted -File configure-iis.ps1"}'


Set up Firewall

Run this az vm open-port command to open port 80 (HTTP) through the firewall.

az vm open-port \
--name myVM \
--resource-group 79fdb1a1-c11e-4716-8a08-f9c4d710ed47 \
--port 80


Verify Site

az vm show \
--name myVM \
--resource-group 79fdb1a1-c11e-4716-8a08-f9c4d710ed47 \
--show-details \
--query [publicIps] \
--output tsv


Check the page in a browser…



Install the Azure CLI on Windows

Azure Az Commands

Official Documentation by Microsoft