DEV Community

kamavadhani
kamavadhani

Posted on

Azure Functions: V2 Python Programming Model Example

Prerequisites:
Before we begin, make sure you have the following
prerequisites set up:
1.Visual Studio Code installed on your machine.
2.Azure Functions Core Tools installed globally.
3.Azure Functions Extension for Visual Studio Code installed.

after installing the above prerequisites go to visual studio code and in the left hand side bar click on azure icon it will ask you to sign in to you azure account.after successfull login you will be able to see local workspace at the left hand side bar

Image description

you will able to see workspace

Image description

after this create new project
you will be prompted to** select programming language
python v2 programing model.**

if you are asking

  • Http Trigger

  • Time Trigger

  • Azure Blob Storage

  • Azure Cosmos Db Trigger
    etc

select for any change in the above cases your function need to call select that particular trigger

you will get the following files after successful creation of function

  1. function_app.py
  2. host.json
  3. local.settings.json
  4. requirements.txt

here make sure your local settings are like env variables in python these wont be deployed when we deploy this to azure functions , these variables we need to defines in app settings when deployed .

create function app code in function_app.py and all the requirements in requirements now you can test the changes locally.

after sucessfully testing the changes we can directly deploy from in the same local workspace to deploy app.

Top comments (0)