Debug Azure Functions

Since July I’m doing an assignment where Azure functions are intensively used. The functions are developed in Visual Studio, which has many advantages over developing functions in the Azure Portal. In Visual Studio you have intellisense, functions can be brought under source control and you can easily debug function execution. When you develop a Http Trigger function, you can perform the following steps:

  • Set Function project as the StartUp Project.
  • Set breakpoints in your function code.
  • Check if all application settings are contained in local.settings.json. When debugging the application settings from the Azure Portal are not used.

Example local.settings.json:
“IsEncrypted”: false,
“Values”: {
“APPINSIGHTS_INSTRUMENTATIONKEY”: “1ef50250-49f8-463d-849a-e264336c6797”,
“AzureWebJobsStorage”: “DefaultEndpointsProtocol=https;AccountName=…;AccountKey=…;”,
“AzureWebJobsDashboard”: “DefaultEndpointsProtocol=https;AccountName=…;AccountKey=…;”,
“AfasGetPos”: “{0}”,
“AfasGetPosTake”: “1000”,
“AfasToken”: “PHRva2Vu…48L3Rva2VuPg==”
“ConnectionStrings”: {
“OutputDataConnectionString”: “,1433;Initial Catalog=db-blo-asb-dev-sql;Persist Security Info=False; …”

  • Press <F5> to start debug mode.

  • Copy the address from the debug Window that appears
  • Open Postman. Select POST as the Http method. Copy the function address in the address box. Enter the correct body and click submit.
  • The function will be called and the first breakpoint is hit in Visual Studio.

Following the above procedure, you can also debug a Queue trigger function. The only problem is, that you will not get an address after pressing <F5>.

That actually makes sense, because you are not calling a Http service. What you do after pressing <F5> is, drop a message in an Azure Storage queue via the Azure Storage Explorer. The function will be called again and the first breakpoint is hit in Visual Studio.

For remote debugging, see: TwoCents post.