Fix: exclude Dev/Test subscriptions from Azure Hybrid Benefit reports
Problem
The Rate Optimization workbook's Azure Hybrid Benefit (AHB) reports incorrectly included Dev/Test subscriptions, even though Azure Hybrid Benefit doesn't apply to these resources. Dev/Test subscriptions come with Visual Studio licenses that already cover Windows operating system costs, making them ineligible for Azure Hybrid Benefit.
This issue could lead to:
- Incorrect license tracking and compliance reporting
- Confusion about which resources actually consume AHB licenses
- Potential over-counting of AHB usage
Root Cause
Analysis of the AHB workbook queries revealed that 4 out of 48 subscription-related queries were missing the Dev/Test exclusion filter. Specifically, all 4 queries were for Virtual Machine Scale Sets (VMSS):
- 2 queries in
src/workbooks/optimization/AHB/AHB.workbook(VMSSAHBEnabled-RG and VMSSAHBDisabled-RG) - 2 queries in
src/workbooks/optimization/Compute/AHB.workbook
The remaining 44 queries already had the correct filter in place, using the pattern:
where tostring (properties.subscriptionPolicies.quotaId) !has "MSDNDevTest_2014-09-01"
Solution
Added the Dev/Test subscription exclusion filter to all 4 affected VMSS queries. This aligns them with:
-
Microsoft licensing requirements: Azure Hybrid Benefit for Windows Server requires Software Assurance or subscription licenses through commercial licensing agreements, which Dev/Test subscriptions don't use.
-
Existing workbook patterns: 91.7% of queries (44/48) already excluded Dev/Test subscriptions correctly.
-
FinOps toolkit documentation: The toolkit's own workbook customization guide explicitly states: "It queries the ResourceContainers table and removes the ones that are Dev/Test because Azure Hybrid Benefit doesn't apply to Dev/Test resources."
Changes
-
src/workbooks/optimization/AHB/AHB.workbook: Added Dev/Test filter to 2 VMSS queries -
src/workbooks/optimization/Compute/AHB.workbook: Added Dev/Test filter to 2 VMSS queries -
docs-mslearn/toolkit/changelog.md: Documented the fix
Testing
- ✅ Validated JSON syntax for both modified workbook files
- ✅ Verified all 48 subscription queries now include the Dev/Test exclusion filter
- ✅ Code review completed with no issues
Impact
Dev/Test subscriptions are now automatically excluded from all Azure Hybrid Benefit reports. This provides accurate license tracking without requiring users to manually filter or toggle subscription types.
Fixes #1855
Original prompt
This section details on the original issue you should resolve
<issue_title>Rate Optimization workbook, Hybrid Benefit report includes Dev/Test subscriptions by default</issue_title> <issue_description>Azure Hybrid Benefits should not be shown as being applied to a AHB report. All the Windows licenses are covered by the Visual Studio licenses.
Either change the report to auto exclude the Dev/Test plan subscriptions or put a toggle on the report to easily exclude.
</issue_description>
<agent_instructions>Triage the issue, research using mslearn, provide proposed solutions along with links/citations to authorative sources.</agent_instructions>
Comments on the Issue (you are @copilot in this section)
@arthurclares @cassiejones444 Where you are seeing this? Workbook or Power BI report?
Fixes microsoft/finops-toolkit#1819
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.