If you saw my Update Management post on Workbooks you know I really like them. But if you read that post then you also know I really want a way for my workbooks to dynamically select resources, or in my case dynamically select all my Log Analytics workspaces. Well I found out how to do it by looking through pre-built Azure Monitor Workbooks Microsoft has released. By the way, this is a great way to learn about what workbooks can do. There are a number of pre-built workbooks out there for various solutions.
I take no credit for this I’m just breaking it down for easier consumption.
First in your workbook, click on Add Parameters down at the bottom. Then click Add Parameter.
This will bring up a blade to the right. Give your parameter a name, select Resource Picker as the Parameter type. Required, isn’t necessary but if you’re using the parameter the queries wont run without it selected. Unless you manually select your workspaces. And also select Allow Multiple Selections.
Then select “Query” by Get data from. Select All Subscriptions or whichever Subscriptions you want to query.
Then you can use this query to get all Log Analytics workspaces, but you can use this for any resource you want with Azure Resource Graph.
where type =~ 'microsoft.operationalinsights/workspaces' | summarize by id, name
Click run query and if you’ve done everything correctly you’ll see all your workspaces.
Then below that be sure to select “All.”
Save it. Now you’ll have drop down parameter that should show “All” as well as all your individual workspaces.
Next in your query segments under Log Analytics workspaces you’ll have the parameter name that you created above.
Now your workbooks will dynamically select resources when they are added or removed from your subscriptions.
Hi, I’m Billy York. I’m a Cloud and Datacenter Management MVP, specializing in monitoring and automation. Here you’ll find posts about AzureMonitor, LogAnalytics, System Center Operations Manager, Powershell, Hyper-V, Azure Automation, Azure Governance and other Microsoft related technologies.