Remote debugging Azure Functions

InĀ a previous post we talked about debugging an Azure function in Visual Studio. You can also debug a function deployed to Azure, ie. remote debugging.

There’s a few points to note:

    • For remote debugging to work, we will have to deploy the function container in Debug mode.
    • Next open the Azure Portal. In the Application Settings of the function container set Remote Debugging to true.

  • Open Visual Studio. Go the Server Explorer. Under your subscription, open the resource group and right click the function to select Attach Debugger from the context menu.
  • Set breakpoints for the execution to halt.

Finally call the function from Postman.

The function address can be found on the code page after clicking [Get function URL). Skip the function key which is specified via the query parameter named code. You need a function key because you want to call the function with AuthorizationLevel.Function. Also note that you don’t have to skip the function key from the address. It’s just nicer to pass the function key via a service header.

The function key is separately avaliable via the Manage tab. Note that it has the same value as contained in the code parameter of the URL.

Pass the function key via a header named x-functions-key. Next call the function and debug it.