Create a Web App using Azure CLI
1. Create a Web App using Azure CLI
2. Deploy a .NET Web App to Azure using Visual Studio
3. Add a custom domain to an Azure Web App
4. Configure SSL for an Azure Web App using an App Managed Certificate
5. Configure SSL for an Azure Web App using Let's Encrypt
Create Web App resources
Connect to Cloud Shell
Sign into the Azure admin portal
https://portal.azure.com
Open Cloud Shell - Create storage
Change to Bash shell
Create a Resource Group
# Define resource group variables rgName=www-planetexpress-rg rgLocation=ukwest # Create resource group and output results to a table az group create --name $rgName --location $rgLocation --output table
Create a Storage Account
# Define storage account variables saName=wwwplanetexpresssa rgName=www-planetexpress-rg location=ukwest sku=Standard_LRS kind=StorageV2 # create storage account az storage account create --name $saName --resource-group $rgName --location $location --sku $sku --kind $kind
Create an App Service Plan
An App Service Plan defines the compute resources used to run Web Apps (similar to a server farm). You can choose Windows or Linux operating systems, the number of Virtual Machine instances (workers) and the size of VMs.
- Workers are the virtual machines that run your apps.
- Each worker unit is a VM instance or node in the server farm, and each one has a cost.
- You'll need to create an App Service plan before you can create a Web App
The options used in this guide are examples for testing only. For production websites, you might want to add these options: --sku --number-of-workers
You can check the different options and features for App service plan SKUs here.
App Service pricing
https://azure.microsoft.com/en-gb/pricing/details/app-service/windows
# Create an App service plan az appservice plan create -g www-planetexpress-rg -n www-planetexpress-plan
This command will create a default Windows App service plan, B1:1 with 1 worker if other options are not specified.
Create a Web App
Create a Web App that uses the App Service Plan we created in the previous step -p www-planetexpress-plan
# Create a web app az webapp create -g www-planetexpress-rg -p www-planetexpress-plan -n www-planetexpress-app
You can stop / restart your web app from the Overview tab
References:
Azure CLI az appservice plan
https://docs.microsoft.com/en-us/cli/azure/appservice/plan
Azure CLI az webapp
https://docs.microsoft.com/en-us/cli/azure/webapp
Comments