@Amar-Azure-Practice There is a vscode limitation: https://code.visualstudio.com/docs/editor/debugging#_remote-debugging
I have also taken this up with VS code product team and they have confirmed that there are currently no plans to support Functions remote debugging in Visual Studio Code.
Azure functions remote debugging in Visual Studio Code
Hi
I am looking for what are all the available options to debug the remote Azure functions in Visual Studio code.
We have Azure functions developed in C# using Visual Stud code we are able to deploy the Azure functions..
we are able to debug locally but after deploying the Azure functions to Azure we want to debug.
Please let us know what are all the available options.
2 answers
Sort by: Most helpful
-
JayaC-MSFT 5,531 Reputation points
2020-11-10T18:07:24.06+00:00 -
sadomovalex 3,631 Reputation points
2020-11-06T15:10:12.747+00:00 debug is available when you run Azure functions locally but not on the portal. In the portal you may use functions' trace logs (Run and Test > Log) to see what happens when it runs there. For doing that you will need to add descriptive logging to your code which not only logs errors and warnings but also logs basic information about execution status (current state, return values from internal methods, local variables, etc) to output:
[FunctionName("MyFunction")] public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)]HttpRequestMessage req, TraceWriter log) { try { log.Info("Start MyFunction.Run"); ... log.Info("Current state: ..."); ... log.Info("Finish MyFunction.Run"); } catch (Exception ex) { log.Error($"Error occured: {ex.Message}"); } }