Microsoft created the new FinOps Best Practices Library, a resource that helps you understand and customize the recommendations provided by the Azure Cost Optimization workbook.
What is the FinOps Best Practices Library?
This library, part of the FinOps Toolkit, offers a central location for Azure best practices, specifically focusing on the Azure Resource Graph (ARG) queries that power the Cost Optimization workbook's recommendations. It allows you to:
- Gain full transparency into the ARG queries behind the recommendations.
- Easily adjust the ARG queries to better suit your unique infrastructure and financial goals.
Whether you're looking to improve your cloud financial management or discover new ways to control costs, this library becomes your essential resource.
Let's explore how these ARG queries work with a simplified example. The code is divided into three parts:
-
Finding Unattached Disks: This section identifies unmanaged disks by searching through Azure Compute resources and filtering for disks not connected to any virtual machines.
resources | where type =~ 'microsoft.compute/disks' and managedBy == ""
-
Filtering by Disk State and Tags: Next, it excludes disks in an inactive state or with specific tags indicating their use in replication scenarios (e.g., Azure Site Recovery).
| extend diskState = tostring(properties.diskState) | where diskState != 'ActiveSAS' and tags !contains 'ASR-ReplicaDisk' and tags !contains 'asrseeddisk'
-
Displaying Relevant Information: Finally, it presents the most relevant details about each disk, such as name, size, SKU, and creation time.
| extend DiskId=id, DiskName=name, DiskSizeGB=tostring(properties.diskSizeGB), SKUName=sku.name, Location=location, TimeCreated=tostring(properties.timeCreated) | order by DiskId asc | project DiskId, DiskName, DiskSizeGB, SKUName, Location, TimeCreated
This is the complete code snippet used in this example:
resources | where type =~ 'microsoft.compute/disks' and managedBy == "" | extend diskState = tostring(properties.diskState) | where managedBy == "" and diskState != 'ActiveSAS' and tags !contains 'ASR-ReplicaDisk' and tags !contains 'asrseeddisk' | extend DiskId=id, DiskIDfull=id, DiskName=name, SKUName=sku.name, SKUTier=sku.tier, DiskSizeGB=tostring(properties.diskSizeGB), Location=location, TimeCreated=tostring(properties.timeCreated), SubId=subscriptionId | order by DiskId asc | project DiskId, DiskIDfull, DiskName, DiskSizeGB, SKUName, SKUTier, resourceGroup, Location, TimeCreated, subscriptionId
If you're unfamiliar with the Cost Optimization workbook, it's a valuable tool within Azure Advisor that helps organizations identify potential savings by analyzing cloud spending and providing actionable insights. You can learn more about it here (link provided).
New to FinOps Toolkit?
The FinOps Toolkit is an open-source resource collection designed to assist you in implementing and optimizing cloud financial operations within the Microsoft Cloud. It offers tools, automation, and guidance, including the "Implementing FinOps" guide - perfect for beginners on their FinOps journey. Explore more about the toolkit and how to contribute to the FinOps Toolkit website (link provided).