Steen Ødegaard
Steen Ødegaard

Reputation: 35

Debug one out of many azure functions

I have an Azure functions app with multiple functions. I have installed the Azure Functions Core Tools to enable debugging. Is there a way to debug one function at a time. My local setup is pointing to the test environment queues, so all functions can be triggered, which can be confusing when trying to debug.

Upvotes: 1

Views: 424

Answers (2)

David Johnson
David Johnson

Reputation: 31

You can reference your Azure Function library from a console app. You can then call functions that would normally be triggered by a timer from the console app. This allows for easy unit testing, and you don't have to remember to re-enable timed functions.

Upvotes: 0

Mikhail Shilkov
Mikhail Shilkov

Reputation: 35154

It's not an ideal solution, but you can temporary put [Disable] attribute on functions that you don't need.

It also supports more advanced scenarios like [Disable("settingname")] to enable/disable based on current setting value and [Disable(typeof(DisableProvider))] to disable based on logic that you can define yourself.

I can imagine you could make a DisableProvider that would return just one function as enabled - the one you are trying to debug.

Upvotes: 1

Related Questions