Back to Blog
Part 3 of 8
AzureServerlessAzure FunctionPython

Azure Functions Tutorial: Creating Function App

October 1, 20222 min read
Share:

Creating Azure Function App#

Note

We'll create the Azure Function using Azure Portal, but this can also be done via VS Code or Azure CLI.

Create Function App in Azure Portal#

  1. Select resource group az-func-demo-wus
  2. Click +Create in the overview tab
  3. Search for Function App in marketplace and click create

Configuration Options#

SettingValue
Function App namefunction-demo (globally unique)
PublishCode
Runtime stackPython
Version3.9
RegionWest US
Operating SystemLinux
Plan TypeConsumption
  1. Under Monitoring tab, ensure Application Insight is enabled
  2. Under Deployment tab, link your GitHub repository
  3. Click Review+Create and wait for deployment

Refresh VS Code#

  1. Click on Azure extensionResourcesFunction App → Refresh
Tip

If refresh doesn't work, try re-authenticating: Press Cmd+Shift+P and select Azure: Sign Out, then login again.

Create Function from VS Code#

  1. Click Azure extensionWorkspace+ icon → Create HTTP Function
  2. Select Python as language
  3. Select python3.9 as interpreter
  4. Name your function: functiondemo

VS Code will create this structure:

.
├── README.md
├── host.json
├── local.settings.json
├── requirements.txt
└── functiondemo
    ├── __init__.py
    ├── function.json
    └── sample.dat

Test Locally#

  1. Add .vscode, .venv, __pycache__ to .gitignore
  2. Run → Run Without Debugging
  3. Test the endpoint: http://localhost:7071/api/functiondemo

Deploy to Azure#

git add .
git commit -m "First Commit"
git push

Once GitHub Action completes, verify at: https://function-demo.azurewebsites.net/api/functiondemo

YS

Yogesh Sharma

Principal Software Engineer @ Intuit