Have you ever wanted to pin the results of an Azure Log Analytics query to an Azure Dashboard when the query returns no results? I know I have. Unfortunately, the pin to dashboard is greyed out when no results are returned. Hopefully one day Azure will allow us. In the meantime, you can use this quick and dirty trick to do it.
So, perform your query as normal. You will have your results showing nothing. Something like in the image below.
The query I am using is one that will create a table of servers and their disks that have less than 10GB free disk space. As you can see I have no results and the Pin to Dashboard button is greyed out.
Change the query so it returns a result. For me and this query, I am going to change the less than value to say 200GB. The query will then return some results. And the Pin to Dashboard button is now available.
Go ahead and pin it to your dashboard and navigate to it.
Now find your newly pined tile and click on the </> button.
In here edit your query so it returns no results again. So in my case, I will change the 200 back to 10. Then click Test. As long as the test comes back ok just click on Apply.
Now click Save a copy on the purple bar at the top.
There you go you now have your query that has no results pinned to an Azure dashboard.
I hope you found this article helpful and if you have any questions please reach out or leave a comment below.