-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhybrid_benefit_tracker_workbook.json
57 lines (57 loc) · 9.53 KB
/
hybrid_benefit_tracker_workbook.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{
"contentVersion": "1.0.0.0",
"parameters": {
"workbookDisplayName": {
"type": "string",
"defaultValue": "Azure Hybrid Benefit Workbook",
"metadata": {
"description": "The friendly name for the workbook that is used in the Gallery or Saved List. This name must be unique within a resource group."
}
},
"workbookType": {
"type": "string",
"defaultValue": "workbook",
"metadata": {
"description": "The gallery that the workbook will been shown under. Supported values include workbook, tsg, etc. Usually, this is 'workbook'"
}
},
"workbookSourceId": {
"type": "string",
"defaultValue": "Azure Monitor",
"metadata": {
"description": "The id of resource instance to which the workbook will be associated"
}
},
"workbookId": {
"type": "string",
"defaultValue": "[newGuid()]",
"metadata": {
"description": "The unique guid for this workbook instance"
}
}
},
"resources": [
{
"name": "[parameters('workbookId')]",
"type": "microsoft.insights/workbooks",
"location": "[resourceGroup().location]",
"apiVersion": "2022-04-01",
"dependsOn": [],
"kind": "shared",
"properties": {
"displayName": "[parameters('workbookDisplayName')]",
"serializedData": "{\"version\":\"Notebook/1.0\",\"items\":[{\"type\":1,\"content\":{\"json\":\"## Welcome to the Azure Hybrid Benefit Tracking Dashboard\\r\\nThis dashboard will assist you in tracking the usage of your available Azure Hybrid Benefit utilization for Windows Server Virtual Machines in Azure. You can get started by filling in the AHB Entitlement field below with the number of Azure Hybrid Benefit cores which your organization is entitled to. Please note the following important points when using this tool:\\r\\n- This dashboard currently only provides information on Windows Server utilization. SQL Server on Azure VMs, SQL Managed Instance, Azure SQL, and Red Hat Linux are not included in this report. Keep an eye on the [GitHub repository](https://github.com/rlowellfl/azure_workbooks) for future updates and additional views.\\r\\n- The charts and resources below are based on the Virtual Machines which your user account has RBAC access to view. Virtual machines in other tenants, management groups, subscriptions, or resource groups which are not visibile to you will not be calculated and the totals above may be inaccurate. Please ensure that your organization remains [in compliance](https://learn.microsoft.com/en-us/windows-server/get-started/azure-hybrid-benefit#how-to-maintain-compliance) with all license terms and conditions for Azure Hybrid Benefit.\\r\\n\"},\"name\":\"text - 3\"},{\"type\":9,\"content\":{\"version\":\"KqlParameterItem/1.0\",\"parameters\":[{\"id\":\"90fdf506-ca5e-4fa4-80fd-fb6a3f5b8c61\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"AHBCores\",\"label\":\"AHB Entitlement\",\"type\":1,\"description\":\"Enter the total number of cores which your Azure Hybrid Benefit entitlements allow.\",\"isRequired\":true,\"timeContext\":{\"durationMs\":86400000},\"value\":\"0\"},{\"id\":\"ce5df180-9d80-4a35-9dfc-3d042015a66e\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"TotalCores\",\"label\":\"Total VM Cores\",\"type\":1,\"query\":\"resources \\r\\n| where type =~ 'Microsoft.Compute/virtualMachines'\\r\\n| extend licenseType = tostring(properties.['licenseType'])\\r\\n| extend vmSize = tostring(properties.hardwareProfile['vmSize'])\\r\\n| extend Cores = extract(@\\\"^[^\\\\d]*(\\\\d+)\\\", 1, vmSize, typeof(int))\\r\\n| summarize sum(Cores)\",\"crossComponentResources\":[\"value::all\"],\"timeContext\":{\"durationMs\":86400000},\"queryType\":1,\"resourceType\":\"microsoft.resourcegraph/resources\"},{\"id\":\"68398066-e44f-4b87-9927-4831fa978165\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"ConsumedCores\",\"label\":\"AHB Cores In Use\",\"type\":1,\"query\":\"resources \\r\\n| where type =~ 'Microsoft.Compute/virtualMachines'\\r\\n| extend licenseType = tostring(properties.['licenseType'])\\r\\n| extend AHUB = iff((licenseType in (\\\"Windows_Server\\\")), \\\"Yes\\\", \\\"No\\\")\\r\\n| where AHUB == \\\"Yes\\\"\\r\\n| extend vmSize = tostring(properties.hardwareProfile['vmSize'])\\r\\n| extend CoresInUse = extract(@\\\"^[^\\\\d]*(\\\\d+)\\\", 1, vmSize, typeof(int))\\r\\n| summarize coresused = sum(CoresInUse)\",\"crossComponentResources\":[\"value::all\"],\"timeContext\":{\"durationMs\":86400000},\"queryType\":1,\"resourceType\":\"microsoft.resourcegraph/resources\"},{\"id\":\"3b03af15-7e74-4eee-83d7-d97aff338b52\",\"version\":\"KqlParameterItem/1.0\",\"name\":\"AvailAHBCores\",\"label\":\"AHB Cores Available\",\"type\":1,\"criteriaData\":[{\"criteriaContext\":{\"operator\":\"Default\",\"resultValType\":\"expression\",\"resultVal\":\"{AHBCores} - {ConsumedCores}\"}}]}],\"style\":\"pills\",\"queryType\":0,\"resourceType\":\"microsoft.resourcegraph/resources\"},\"name\":\"parameters - 1\"},{\"type\":12,\"content\":{\"version\":\"NotebookGroup/1.0\",\"groupType\":\"editable\",\"items\":[{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"resources \\r\\n| where type =~ 'Microsoft.Compute/virtualMachines'\\r\\n| extend licenseType = tostring(properties.['licenseType'])\\r\\n| extend vmSize = tostring(properties.hardwareProfile['vmSize'])\\r\\n| extend Cores = extract(@\\\"^[^\\\\d]*(\\\\d+)\\\", 1, vmSize, typeof(int))\\r\\n| extend AHUB = iff((licenseType in (\\\"Windows_Server\\\")), \\\"Yes\\\", \\\"No\\\")\\r\\n| summarize ahubcount=count() by AHUB\",\"size\":1,\"title\":\"Virtual Machines using Hybrid Benefit\",\"queryType\":1,\"resourceType\":\"microsoft.resourcegraph/resources\",\"crossComponentResources\":[\"value::all\"],\"visualization\":\"piechart\",\"chartSettings\":{\"seriesLabelSettings\":[{\"seriesName\":\"No\",\"label\":\"Not using AHB\",\"color\":\"redBright\"},{\"seriesName\":\"Yes\",\"label\":\"Using AHB\",\"color\":\"blue\"}],\"ySettings\":{\"numberFormatSettings\":{\"unit\":17,\"options\":{\"style\":\"decimal\",\"useGrouping\":false}}}}},\"customWidth\":\"33\",\"name\":\"query - 2\",\"styleSettings\":{\"showBorder\":true}},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"resources \\r\\n| where type =~ 'Microsoft.Compute/virtualMachines'\\r\\n| extend licenseType = tostring(properties.['licenseType'])\\r\\n| extend vmSize = tostring(properties.hardwareProfile['vmSize'])\\r\\n| extend Cores = extract(@\\\"^[^\\\\d]*(\\\\d+)\\\", 1, vmSize, typeof(int))\\r\\n| extend AHUB = iff((licenseType in (\\\"Windows_Server\\\")), \\\"Yes\\\", \\\"No\\\")\\r\\n| where AHUB == \\\"Yes\\\"\\r\\n| extend Optimal = iff((Cores >= 8),\\\"Yes\\\", \\\"No\\\")\\r\\n| summarize optcount = count(Optimal) by Optimal\\r\\n\",\"size\":1,\"title\":\"Azure Hybrid Benefit Use Optimization\",\"exportToExcelOptions\":\"all\",\"queryType\":1,\"resourceType\":\"microsoft.resourcegraph/resources\",\"crossComponentResources\":[\"value::all\"],\"visualization\":\"piechart\",\"chartSettings\":{\"yAxis\":[\"optcount\"],\"seriesLabelSettings\":[{\"seriesName\":\"No\",\"label\":\"Suboptimal\",\"color\":\"orange\"},{\"seriesName\":\"Yes\",\"label\":\"Optimal\",\"color\":\"green\"}],\"ySettings\":{\"numberFormatSettings\":{\"unit\":0,\"options\":{\"style\":\"decimal\",\"useGrouping\":true}}}}},\"customWidth\":\"33\",\"name\":\"query - 3\",\"styleSettings\":{\"showBorder\":true}}]},\"name\":\"Charts\"},{\"type\":3,\"content\":{\"version\":\"KqlItem/1.0\",\"query\":\"resources \\r\\n| where type =~ 'Microsoft.Compute/virtualMachines'\\r\\n| extend licenseType = tostring(properties.['licenseType'])\\r\\n| extend vmSize = tostring(properties.hardwareProfile['vmSize'])\\r\\n| extend Cores = extract(@\\\"^[^\\\\d]*(\\\\d+)\\\", 1, vmSize, typeof(int))\\r\\n| extend AHUB = iff((licenseType in (\\\"Windows_Server\\\")), \\\"Yes\\\", \\\"No\\\")\\r\\n| extend Optimal = iff((Cores >= 8), \\\"Yes\\\", \\\"No\\\")\\r\\n| extend Consumed = iff((AHUB == \\\"Yes\\\"), iff((Cores >= 8), Cores, 8), 0)\\r\\n| project subscriptionId, resourceGroup, name, Cores, AHUB, Consumed, Optimal\",\"size\":0,\"showExportToExcel\":true,\"queryType\":1,\"resourceType\":\"microsoft.resourcegraph/resources\",\"crossComponentResources\":[\"value::all\"],\"gridSettings\":{\"formatters\":[{\"columnMatch\":\"Group\",\"formatter\":1}],\"sortBy\":[{\"itemKey\":\"Optimal\",\"sortOrder\":1}],\"labelSettings\":[{\"columnId\":\"subscriptionId\",\"label\":\"Subscription ID\"},{\"columnId\":\"resourceGroup\",\"label\":\"Resource Group\"},{\"columnId\":\"name\",\"label\":\"VM Name\"},{\"columnId\":\"Cores\",\"label\":\"VM Cores\",\"comment\":\"Number of vCPU cores on this VM.\"},{\"columnId\":\"AHUB\",\"label\":\"Azure Hybrid Benefit?\",\"comment\":\"Is Azure Hybrid Benefit enabled on this VM?\"},{\"columnId\":\"Consumed\",\"label\":\"AHUB Cores\",\"comment\":\"Number of Azure Hybrid Benefit cores consumed by this VM.\"},{\"columnId\":\"Optimal\",\"label\":\"Optimal Use?\",\"comment\":\"Optimal use is 8 cores or greater. Virtual machines with less than 8 cores require at least 8 Hybrid benefit core entitlements.\"}]},\"sortBy\":[{\"itemKey\":\"Optimal\",\"sortOrder\":1}]},\"name\":\"query - 0\"}],\"isLocked\":false,\"fallbackResourceIds\":[\"Azure Monitor\"]}",
"version": "1.0",
"sourceId": "[parameters('workbookSourceId')]",
"category": "[parameters('workbookType')]"
}
}
],
"outputs": {
"workbookId": {
"type": "string",
"value": "[resourceId( 'microsoft.insights/workbooks', parameters('workbookId'))]"
}
},
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#"
}