/
How to develop Azure functions ?

How to develop Azure functions ?

It’s recommended that you develop your functions locally and publish to a function app in Azure : Develop and run Azure Functions locally | Microsoft Learn

Local development environments

Visual Studio Code (Azure Functions extension for VS Code), Comand prompt or terminal (Azure Functions Core Tools), Visual Studio (Azure Functions Tools), Maven (Maven Archetype supports Core Tools for Java functions).

Don't mix local development with portal development in the same function app. When you create and publish functions from a local project, you won't be able to maintain or modify project code in the portal.

Local project files

Function project directory contains the following files in project root folder regardless of language
{ "IsEncrypted": false, "Values": { "FUNCTIONS_WORKER_RUNTIME": "<language worker>", "AzureWebJobsStorage": "<connection-string>", "MyBindingConnection": "<binding-connection-string>", "AzureWebJobs.HttpExample.Disabled": "true" }, "Host": { "LocalHttpPort": 7071, "CORS": "*", "CORSCredentials": false }, "ConnectionStrings": { "SQLConnectionString": "<sqlclient-connection-string>" } }

Triggers & bindings

When you develop your functions locally, you need to take trigger and binding behaviors into consideration. The easiest way to test bindings during local development is to use connection strings that target live Azure services. You can target live services by adding the appropriate connection string settings in the Values array in the local.settings.json file. When you do this, local executions during testing impact live service data.

Debug Azure Functon locally

  1. During local development, you can use the local Azurite emulator when testing functions with Azure Storage bindings (Queue Storage, Blob Storage, and Table Storage), without having to connect to remote storage services : Use Azurite emulator for local Azure Storage development | Microsoft Learn

  2. Debug by attaching to process in Visual Studio : Azure Functions: how to debug remotely in production – Stefano Demiliani

 

  1. Debugging via Publish Profile

If you have deployed your Azure Function app from Visual Studio to an Azure Subscription, open your project, right-click on the function app and select Publish. The publish profile page will be opened and here you can click on the 3 dots in the hsoting details and select Attach Debugger: