Jirka's Public Notepad

Data Engineering | Python | SQL Server | Teradata

August 14, 2020 By Jiří Hubáček 1 Comment

Provisioning Azure App Service for Flask App using Azure CLI

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.

Source: https://azure.microsoft.com/en-us/services/app-service/#features

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

Conclusion

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

Related

Filed Under: Azure Tagged With: appservice, azure, cli, flask, python, webapp

Trackbacks

  1. SSH into App Service Linux Container says:
    August 16, 2020 at 1:39 pm

    […] the previous post, I shared how to provision an App Service for Flask application using Azure CLI. This post is a […]

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • GitHub
  • LinkedIn
  • RSS
  • Twitter
© 2022 · Jiří Hubáček, PGP