git clone https://github.com/dsanchor/azure-function-simple-python.git
RG=<target-rg> # Ex: test-function-rg
LOCATION=<resources-location> # Ex: westeurope
SA=<storage-account-name> # Ex: testfunction1123sa
FUNCAPP=<func-app-name> #Ex: test-function-1123
CODE_LOCATION=<cloned-code-location>
az login
az group create --name $RG --location $LOCATION
az storage account create --name $SA --location $LOCATION --resource-group $RG --sku Standard_LRS
az functionapp create --resource-group $RG --consumption-plan-location $LOCATION --runtime python --runtime-version 3.8 --functions-version 4 --name $FUNCAPP --os-type linux --storage-account $SA
- Navigate to the function app directory
cd $CODE_LOCATION
Two options:
- Publish the function app to Azure with func cli:
func azure functionapp publish $FUNCAPP
- Publish the function using the az cli:
zip publish.zip -r function_app.py host.json
az functionapp deployment source config-zip --resource-group $RG --name $FUNCAPP --src ./publish.zip
curl https://$FUNCAPP.azurewebsites.net/api/http_trigger?name=Azure