The most basic Flask "hello world" application as an AZD template ready for Azure App Service
graph TD
logs[logs<br>config] --> web[web<br>sites]
appSettings[appSettings<br>config] --> web[web<br>sites]
web[web<br>sites] --> appServicePlan[appServicePlan<br>serverfarms]
style logs fill:#1f2937,stroke:#fff,color:#fff
style appSettings fill:#1f2937,stroke:#fff,color:#fff
style web fill:#25282a,stroke:#fff,color:#fff
style appServicePlan fill:#25282a,stroke:#fff,color:#fff
- Install AZD and run the following command to initialize the project.
azd init --template Azure-Samples/azd-simple-flask-appservice
This command will clone the code to your current folder and prompt you for the following information:
Environment Name
: This will be used as a prefix for the resource group that will be created to hold all Azure resources. This name should be unique within your Azure subscription.
- Login to your Azure account.
azd auth login
- Run the following command to build a deployable copy of your application, provision the template's infrastructure to Azure and also deploy the applciation code to those newly provisioned resources.
azd up
This command will prompt you for the following information:
Azure Location
: The Azure location where your resources will be deployed.Azure Subscription
: The Azure Subscription where your resources will be deployed.
NOTE: This may take a while to complete as it executes three commands:
azd package
(builds a deployable copy of your application),azd provision
(provisions Azure resources), andazd deploy
(deploys application code). You will see a progress indicator as it packages, provisions and deploys your application.
- Then make changes to app.py and run
azd deploy
again to update your changes.
As the template comes, it is set to a basic plan (see pricing guide), but if you want to get started for free, you can easily update the template before you run azd up
to leverage the free plan or the discounted developer plan.
Go to the /infra/resources.bicep file and update line 57, where the SKU is currently set to “B1”
. Change this to “F1”
to deploy up to 10 App Service apps for free on the free plan (or “D1”
for the discounted developer rate if you have more than 10 to deploy concurrently).
This uses the F1 (free) SKU for app service, which has limited CPU and RAM resources.
See the pricing calculator for details on paid SKUs replace the SKU option with a suitable choice.