Azure Web App Service is a runtime for web application or API. They can run on Linux, Windows, or custom Docker image.
This post considers provisioning a Flask application to a Linux host. It demonstrates the process using Azure CLI.
A Web App lives within an App Service Plan grouping configuration for one or more Web Apps. An App Service Plan lives within a Resource Group that can group Azure resources logically together.
Creating Resource Group
az group create --location germanywestcentral --name AzureWebAppCliDemo
Create App Service Plan
SKU translates to App Service’s pricing tier. F1 stands for Free granting 60 minutes of compute power per day and 1GB storage for all apps in the service plan. There may be only a single F1 App Service Plan within the region.
az appservice plan create \ --name DemoApps \ --resource-group AzureWebAppCliDemo \ --sku F1 \ --is-linux
Create Web App
The Name becomes the Web App’s URL; deployment options are local git, remote git or container registry.
az webapp create \ --name AzureWebAppCliDemoApp \ --plan DemoApps \ --resource-group AzureWebAppCliDemo \ --runtime "Python|3.8" \ --deployment-local-git
That’s it! One would go to the newly created empty site – https://azurewebappclidemoapp.azurewebsites.net in this scenario – and would be presented with the following options:
– Quickstart is a walkthrough of deploying a Hello World application.
– Link to the App Service Deployment Center.
Disabling HTTP access
SSL is set up out of the box so there’s pretty no reason to access the site using unencrypted HTTP.
az webapp update \ --resource-group AzureWebAppCliDemo \ --name AzureWebAppCliDemoApp \ --https-only true
Azure CLI is a powerful cross-platform tool enabling automation and management of Azure resources. I prefer using CLI for most of my production tasks. It’s easily reproducible, verbose and clear what one is up to. Last but not least, it’s easier to document a command and its switches than taking screenshots of Azure Portal wizards.
Inspiration and credits: Deploying Python web apps to Azure App Services