Step by step how to create and user Azure function locally (click here)
Download and Install, Azure Functions Core Tools lets you develop and test your functions on your local computer.
STEP 1 Create a Configuration file (local.settings.json)
STEP 2: Create Order Models
public class Order {
public string id { get; set; }
public DateTime orderDate { get; set; }
public double total { get; set; }
public int priority {get; set;}
public List<OrderItem> items { get; set; }public Order() {
var rand=new Random();
priority=rand.Next(3)+1;
}
}public class OrderItem {
public String name { get; set; }
public int id { get; set; }
public double price { get; set; }
}
STEP 3: Define our Function- that simply logging and return
Check your functions at local workspace
Click Azure Extension Tab - Open Workspace Section.
See your functions at local workspace
We will be able to see the names of the functions right here and we will be able to handle them right from the extension.
Run the Function locally -
Make sure Framework are some or your project an SDK installed i.e 8.0
Press F5 in Vs Code
After some time, build is complete, and now the functions are running
The note that as opposed to websites, we don't have a browser opening up
after building the project in that because in order to use functions,
we call their URL.
On Successful Build, you can see the local url, for running your functions
Test function URLs at local using Postman
Give 200Ok Successful running