I’m looking into Azure Workbooks now, and I’m wondering if the below is actually even possible.
Scenario
- List all function apps under Subscription / Resource Group scope.
This step is done – simple Azure Resource Graph query with parameters does the job.
- Execute Azure Resource Manager action against each Function App that was returned as a part of Query in Step1.
Specifically, I’m interested in detectors/functionExecutionErrors ARM API – and return a parsed result out of it. When doing that for hardcoded resource, I can get the results I need. Using the following JSON Path $.properties.dataset[0].table.rows[0][1]
I get back the summary: All running functions in healthy state with execution failure rate less than 0.1%.
I realize this might either be undoable in Workbooks or something trivial that I missed – it would be easiest if I could just run ‘calculated columns’ when rendering outputs. So, the summarizing question is:
How, if possible, can I combine Azure Resource Graph query with Azure Resource Manager DataSource, where Azure Resource Manager query runs per each returned Graph resource and display them as table in form: "Resource ID | ARM api results".
I think I have achieved closest result to this by marking Resource Graph Query output as parameter (id -> FunctionAppId) and referencing that in ARM query as /{FunctionAppId}/detectors/functionExecutionErrors
– this works fine as long as only one resource is selected, but there are two obstacles: I want to execute against all query results regardless if they are selected, and I need Azure Resource Manager understand it needs to loop resources – not concatenate them (as seen in invoke
HTTP call from F12 dev tools, the resource names are just joined together).
Hopefully there’s someone out there who could help out with this. Thanks! 🙂
2
Answers
I’m also new to Workbooks and I think creating a parameter first with the functionId is best. I do the same 😉
With multiple functions the parameter will have them all. You can use
split()
to get an array and then loop.Will that work for you?
Can you share your solution if you managed to solve this differently?
cloudsma.com
is a resource I use a lot to understand the queries and options better. Like this one: https://www.cloudsma.com/2022/03/azure-monitor-alert-reportsWorkbooks doesn’t currently have an ability to run the ARM data source against many resources, though it is on our backlog and are actively investigating a way to run any datasource for a set of values and merge the results togther.
The general workaround is to do as stated, either use a parameter so select a resource and run that one query for the selected item, or do similar with something like a query step with grid, and have selection of the grid output a parameter used as input to the ARM query step.