Microsoft Azure - Scaling Inventory Resources
Last Updated :
31 Mar, 2023
In this article we will learn how to inventory resources at scale using the Azure Portal and the power of Azure Resource Graph. Azure has always given you a way to inventory your resources for a single subscription. Go to Azure Resource Manager, you can query and get that information. But what if you have hundreds of subscriptions or thousands and thousands of resources? Writing that script is actually quite difficult just to even get a count of how many subscriptions you have. So now, Azure has a new service called Azure Resource Graph. And what this thing does is it runs 24 hours a day and it indexes information about all the resources you have across all your subscriptions at scale. And then on top of it, it provides a KQL based querying language on top of those resources. Azure plans on replanting significant portions of the experience, like its search and all of the lists of resources you see on top of Resource Graph.
Implementation:
In this article, we are going to look into a tool Azure has built that lets you get to the core of Azure Resource Graph and what it can provide. So for that, you will be going to use the Resource Graph Explorer tool, so you can go to search and just type Resource Graph Explorer. . And what you are going to see is a familiar query editing and execution experience that you will see in other kinds of database solutions.
Now, let’s start with the most basic thing, just counting your resources. As mentioned before, if you have got a lot of subscriptions, then writing that script would be tough. But with Resource Graph, it’s as easy as you are going to type count. You are going to run a query. And done. You can go ahead and save this query. And let's just call it My count. One important note, when you say it’s enforcing role-based access control, that means you’re seeing only the resources that you have access to. There are more resources on those subscriptions, but you don’t have access, they will not come here. So, go ahead and pin that to your dashboard.
But the KQL query language is much more powerful than that. Let’s say you want to get an understanding of the different types of resources you have. Summarize count=count by type. And now, you can see all the different resource types that you have and their counts. Even better, let’s say there are lots of them, let’s say you just want to get a sense of the top 10. So, you will go ahead, and say order by count descending take 10. So, the most frequent resources appear on your subscriptions. You could even come over to the charts table. And you can pin that to your dashboard as well.
On the left, you will see a tree that shows all the different types of resources that are in the subscriptions you have access to. And you can unfold this and take a look at all the different specific types that you can query on.
Rather than doing that one by one, go to switch gears and see what Azure has done to integrate with Azure dashboards. So, here are the tiles that you just pinned when you were in the Resource Graph Explorer and ran those queries. You have already created a dashboard and you can go to the link to it in the description below. So, go ahead and click upload and you will go into and grab the dashboard that you have downloaded. And now, what this is going to show is basically a whole bunch of queries that target my subscriptions. And if you upload it, it will show your subscriptions. And it’s going to show you a whole bunch of really interesting queries: the count of all your resources, the top 10 that you just looked at. But then there are things like resource-specific queries. How many VMs do you have? How about that split by operating system or by family? You can click on any of these tiles and get a sense of what that query looks like right here in this context pane.
So, these are basic inventory for compute, storage, and networking, and Azure SQL and App Service. So, you could download this. You could look at the queries. You could extend it. And you can change it to suit your needs. One final thing is a new feature on Azure dashboards here, which is the filter.
So, you can actually come in here and just with a few clicks filter all of these queries down to a subset of subscriptions. And you do that and then all the tiles update. So, using this tool, Azure Resource Graph Explorer, you were able to write some basic queries using the powerful KQL language, create dashboards that you can slice and dice, and filter. And, of course, if you’ve seen Azure other dashboard videos, you can share this dashboard very easily with others in your organization also using role-based access control.
Similar Reads
DevOps Tutorial DevOps is a combination of two words: "Development" and "Operations." Itâs a modern approach where software developers and software operations teams work together throughout the entire software life cycle, from planning and coding to testing, deploying, and monitoring.The main idea of DevOps is to i
9 min read
Introduction
What is DevOps ?DevOps is a modern way of working in software development in which the development team (who writes the code and builds the software) and the operations team (which sets up, runs, and manages the software) work together as a single team.Before DevOps, the development and operations teams worked sepa
10 min read
DevOps LifecycleThe DevOps lifecycle is a structured approach that integrates development (Dev) and operations (Ops) teams to streamline software delivery. It focuses on collaboration, automation, and continuous feedback across key phases planning, coding, building, testing, releasing, deploying, operating, and mon
10 min read
The Evolution of DevOps - 3 Major Trends for FutureDevOps is a software engineering culture and practice that aims to unify software development and operations. It is an approach to software development that emphasizes collaboration, communication, and integration between software developers and IT operations. DevOps has come a long way since its in
7 min read
Version Control
Continuous Integration (CI) & Continuous Deployment (CD)
Containerization
Orchestration
Infrastructure as Code (IaC)
Monitoring and Logging
Microsoft Teams vs Slack Both Microsoft Teams and Slack are the communication channels used by organizations to communicate with their employees. Microsoft Teams was developed in 2017 whereas Slack was created in 2013. Microsoft Teams is mainly used in large organizations and is integrated with Office 365 enhancing the feat
4 min read
Security in DevOps