Skip to content

Python 3.6 function app creates

Sonia Kulkarni edited this page Nov 25, 2019 · 11 revisions

Creating Python 3.6 function app with Az CLI (Recommended)

Pre-requisites:

You can use Cloud Shell to run the commands below. Click on the icon at the top right of portal to open Cloud Shell.

OR

Install the Azure CLI version 2.0.76 or a later version and run the commands from a cmd/terminal on your local machine.

Function app and storage account names must be unique.

storageName=mystorageaccount$RANDOM

functionAppName=myserverlessfunc$RANDOM

pythonVersion=3.6

Create a resource group.

az group create --name myResourceGroup --location westeurope

Create an Azure storage account in the resource group.

az storage account create --name $storageName --location westeurope --resource-group myResourceGroup --sku Standard_LRS

Create a serverless function app in the resource group.

az functionapp create --name $functionAppName --storage-account $storageName --consumption-plan-location westeurope --resource-group myResourceGroup --os-type Linux --runtime python --runtime-version $pythonVersion

Creating Python 3.6 function app with VSCode

(Recommended only if you already have VSCode installed locally)

Pre-requisites:

  • Visual Studio Code
  • The Azure Functions extension. For general information, visit the vscode-azurefunctions GitHub repository.

Sign into Azure

Once you've installed the Azure extension, sign into your Azure account by navigating to the Azure explorer, select Sign into Azure, and follow the prompts. (If you have multiple Azure extensions installed, select the one for the area in which you're working, such as App Service, Functions, etc.)

After signing in, verify that the email address of your Azure account (or "Signed In") appears in the Status Bar and your subscription(s) appears in the Azure explorer:

Create a Function App

Click on View in Menu bar and open the Command Palette (F1) and select the Azure Functions: Create Function App in Azure command. Again, the function app is where your Python project runs in Azure. Follow the prompts:

  1. Enter globally unique name for your function app
  2. Pick “Linux” OS
  3. Pick “Python 3.6.x” runtime
  4. Pick a location to deploy your function app

You can also use Azure Functions: Create Function App in Azure (Advanced) flow if you want to configure more parameters.