How to Share Azure Resource Graph Queries as a Link

This post has been republished via RSS; it originally appeared at: ITOps Talk Blog articles.

Azure Resource Graph is a service in Azure that allows you to performant resource exploration with the ability to query at scale across a given set of subscriptions so that you can effectively govern your environment. You can get an overview of the resources in different subscriptions, and you can even generate charts. You can run these queries from Azure PowerShell or Azure CLI, or to get a view of these queries, you can use Azure Resource Graph Explorer in the Portal.

 

Azure Resource Graph Explorer ChartAzure Resource Graph Explorer Chart

As an example, I used Azure Resource Graph queries, to list the agent version of Azure Arc enabled servers.

To share these queries with others, you have a couple of options. You can share it directly within the Azure portal. 

 

Save Shared Azure Resource Graph QuerySave Shared Azure Resource Graph Query

Create an Azure Resource Graph Explorer Query Link

 

But thanks to David Coulter (Microsoft), I learned that you also can simple create URLs, including the Azure Resource Graph query. This is great if you simply create a link and will automatically copy the query to the Azure Resource Graph Explorer.

 

You can do this by using the following URL and append the URL encoded query to the URL.

 

Query URL:

 

 

https://portal.azure.com/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/

 

 

 

Azure Resource Graph Query:

 

 

Resources| summarize count()

 

 

 

URL encoded Query:

 

 

Resources%7C%20summarize%20count()

 

 

 

To URL encode, you can use a website like Code Beautify or the following Visual Studio Code extension.

 

Complete Azure Resource Graph URL:

 

 

https://portal.azure.com/?feature.customportal=false#blade/HubsExtension/ArgQueryBlade/query/Resources%0D%0A%7C%20summarize%20count%28%29

 

 

 

So if you click on the following link, it will automatically open the Azure Portal with the above Azure Resource Graph Query: 

 

Azure Resource Graph Explorer Query using a LinkAzure Resource Graph Explorer Query using a Link

 

Conclusion

Thanks again to David Coulter or the tip. I hope this gives you an overview of how you can share the Azure Resource Graph Query using a simple link. If you have any questions, feel free to leave a comment.

To learn more about how to create Azure Resource Graph Queries, check out Microsoft Docs: Starter Resource Graph query samples

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.