|
1 |
| -# Project Name |
| 1 | +# Azure Orphan Resources Grafana Dashboard |
| 2 | + |
| 3 | +In cloud computing, it is crucial to follow best practices when building a reliable, high-performing, and secure environment. However, it is equally important to implement a strategy aimed at reducing the total cost of ownership. In this context, this Grafana dashboard offers a centralized view of Azure orphan resources that can be safely removed. By identifying and removing these unnecessary resources, you can effectively decrease the overall cost associated with maintaining their Azure subscriptions and increase the operational efficiency. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +This dashboard is influenced by the [Azure Orphaned Resources 2.0](https://github.com/dolevshor/azure-orphan-resources/tree/main) project developed by my colleague Dolev Shor. It incorporates and integrates some of the queries he designed for his Azure workbook, which can be created and utilized within the Azure Portal. You can refer to the [Azure workbook documentation](https://learn.microsoft.com/en-us/azure/azure-monitor/visualize/workbooks-overview) to learn more about creating and utilizing workbooks in the Azure Portal. |
| 10 | + |
| 11 | +## Prerequisites |
| 12 | + |
| 13 | +You can host the Grafana dashboard in Azure Managed Grafana, your own Grafana installation in an AKS cluster, or any Kubernetes cluster with access to the public internet. |
| 14 | + |
| 15 | +## Implementation |
| 16 | + |
| 17 | +The dashboard performs a series of queries using the [Kusto Query Language](https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/) and [Azure Resource Graph](https://learn.microsoft.com/en-us/azure/governance/resource-graph/overview) to individuate unused, orphan resources that can be safely removed from your Azure subscriptions without impacting the operability of your cloud hosted workloads. Azure Resource Graph is an Azure service designed to extend Azure Resource Management by providing efficient and performant resource exploration with the ability to query at scale across a given set of subscriptions so that you can effectively govern your environment. |
| 18 | + |
| 19 | +For more information Azure Resource Graph, you can refer to the following links: |
| 20 | + |
| 21 | +- [Azure Resource Graph Overview](https://learn.microsoft.com/en-us/azure/governance/resource-graph/overview) |
| 22 | +- [Query Resource Changes](https://learn.microsoft.com/en-us/azure/governance/resource-graph/how-to/get-resource-changes) |
| 23 | + |
| 24 | +Here is the list of the resources currently supported by the dashboard: |
| 25 | + |
| 26 | +- App Service Plans |
| 27 | +- App Service Environments |
| 28 | +- Availability Sets |
| 29 | +- Managed Disks |
| 30 | +- Load Balancers |
| 31 | +- Route Tables |
| 32 | +- Application Gateways |
| 33 | +- Application Gateway WAF Policies |
| 34 | +- Front Door WAF Policies |
| 35 | +- Traffic Manager Profiles |
| 36 | +- Virtual Networks |
| 37 | +- Subnets |
| 38 | +- Network Interfaces |
| 39 | +- Virtual Network Gateways |
| 40 | +- Network Security Groups |
| 41 | +- NAT Gateways |
| 42 | +- Public IP Addresses |
| 43 | +- Public IP Prefixes |
| 44 | +- IP Groups |
| 45 | +- Private DNS Zones |
| 46 | +- Private Endpoints |
| 47 | +- Private Link Services |
| 48 | +- SQL Elastic Pools |
| 49 | +- Resource Groups |
| 50 | + |
| 51 | +Please note that all the resources mentioned above come with an associated cost. Some resources like Availability Sets, Route Tables, Subnets, IP Groups, and Resource Groups are available free of charge. |
| 52 | + |
| 53 | +## Importing the dashboard into Azure Managed Grafana |
| 54 | + |
| 55 | +To import the dashboard into [Azure Managed Grafana](https://learn.microsoft.com/en-us/azure/managed-grafana/overview), follow these steps: |
| 56 | + |
| 57 | +1. Go to the Azure Portal and navigate to your Azure Managed Grafana resource. |
| 58 | +2. Click `Identity` under `Settings`. |
| 59 | +3. Ensure that the system-assigned managed identity is enabled. |
| 60 | +  |
| 61 | +4. Click on the `Azure role assignments` button. |
| 62 | +5. Assign the [Monitoring Reader](https://learn.microsoft.com/en-us/azure/azure-monitor/roles-permissions-security#monitoring-reader) role to the Grafana managed identity, scoped to your Azure subscription or Management Group. |
| 63 | +  |
| 64 | +6. Click on the `Endpoint` URL on the `Overview` page of your Azure Managed Grafana resource. |
| 65 | +7. In the Grafana dashboard, go to `Connections` and ensure that you have an `Azure Monitor` datasource. If not, create one and select `Managed Identity` as the authentication mechanism. |
| 66 | +8. Click on the `Load subscriptions` button to test the data source. |
| 67 | +9. Go to `Dashboards`, click on `New`, and then select `Import`. |
| 68 | +10. Upload the dashboard JSON file or copy and paste the JSON code into the textbox, then click the `Load` button. |
| 69 | +  |
| 70 | +11. Choose a category for the dashboard and click the `Import` button. |
| 71 | + [Upload Dashboard to Azure Managed Grafana](./images/managed-grafana-import-dashboard-02.png) |
| 72 | + |
| 73 | +## Importing the Dashboard into a Bring Your Own (BYO) Grafana Installation |
| 74 | + |
| 75 | +Before importing the dashboard into your own Grafana installation, you need to create a service principal under your Microsoft Azure AD account and assign the [Monitoring Reader](https://learn.microsoft.com/en-us/azure/azure-monitor/roles-permissions-security#monitoring-reader) role to it. Once done, follow these steps: |
| 76 | + |
| 77 | +1. In the Grafana dashboard, go to `Connections` and ensure that you have an `Azure Monitor` datasource. If not, create one and specify the `tenant id`, `client Id`, and `client secret` of your service princiapl as shown in the following picture: |
| 78 | +  |
| 79 | +2. Click on the `Load subscriptions` button to test the data source. |
| 80 | +3. Go to `Dashboards`, click on `New`, and then select `Import`. |
| 81 | +4. Upload the dashboard JSON file or copy and paste the JSON code into the textbox, then click the `Load` button. |
| 82 | +  |
| 83 | +5. Choose a category for the dashboard and click the `Import` button. |
| 84 | +  |
2 | 85 |
|
3 |
| -(short, 1-3 sentenced, description of the project) |
4 |
| - |
5 |
| -## Features |
6 |
| - |
7 |
| -This project framework provides the following features: |
8 |
| - |
9 |
| -* Feature 1 |
10 |
| -* Feature 2 |
11 |
| -* ... |
12 |
| - |
13 |
| -## Getting Started |
14 |
| - |
15 |
| -### Prerequisites |
16 |
| - |
17 |
| -(ideally very short, if any) |
18 |
| - |
19 |
| -- OS |
20 |
| -- Library version |
21 |
| -- ... |
22 |
| - |
23 |
| -### Installation |
24 |
| - |
25 |
| -(ideally very short) |
26 |
| - |
27 |
| -- npm install [package name] |
28 |
| -- mvn install |
29 |
| -- ... |
30 |
| - |
31 |
| -### Quickstart |
32 |
| -(Add steps to get up and running quickly) |
33 |
| - |
34 |
| -1. git clone [repository clone url] |
35 |
| -2. cd [repository name] |
36 |
| -3. ... |
37 |
| - |
38 |
| - |
39 |
| -## Demo |
40 |
| - |
41 |
| -A demo app is included to show how to use the project. |
42 |
| - |
43 |
| -To run the demo, follow these steps: |
44 |
| - |
45 |
| -(Add steps to start up the demo) |
46 |
| - |
47 |
| -1. |
48 |
| -2. |
49 |
| -3. |
50 |
| - |
51 |
| -## Resources |
52 |
| - |
53 |
| -(Any additional resources or related projects) |
54 |
| - |
55 |
| -- Link to supporting information |
56 |
| -- Link to similar sample |
57 |
| -- ... |
|
0 commit comments