1
1
---
2
+ reviewed : 2024-01-03
2
3
severity : Awareness
3
4
pillar : Cost Optimization
4
- category : Pricing and billing model
5
+ category : CO:05 Rate optimization
5
6
resource : Virtual Machine
6
7
online version : https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.VM.UseHybridUseBenefit/
7
8
---
@@ -14,11 +15,31 @@ Use Azure Hybrid Benefit for applicable virtual machine (VM) workloads.
14
15
15
16
## DESCRIPTION
16
17
17
- Azure Hybrid Benefit is a licensing benefit that helps you to reduce costs of running virtual machine (VM) workloads.
18
+ The running cost of Virtual machine (VM) workloads in Azure is composed of several components, including:
19
+
20
+ - Compute usage for the VM size and image billed per second of run time, which may include:
21
+ - Base compute rate for the VM size.
22
+ - Software included on the VM image billed per second of run time, such as Windows Server or SQL Server.
23
+ - Storage usage for the VM disks.
24
+ - Network usage for data transfer in and out of the VM.
25
+ - Usage of other supporting Azure resources, such as load balancers, public IP addresses, or log ingestion.
26
+ - Licensing costs for other software installed on the VM.
27
+
28
+ Azure Hybrid Benefit is a licensing benefit that helps you to reduce your overall cost of ownership.
29
+ With Azure Hybrid Benefit you to use your existing on-premises licenses to pay a reduced rate on Azure.
30
+
31
+ When Azure Hybrid Benefit enabled on supported VM images:
32
+
33
+ - The billing rate for the VM is adjusted to the base compute rate.
34
+ - You must separately have eligible licenses, such as Windows Server or SQL Server because Azure does not include these anymore.
35
+
36
+ For additional information on Azure Hybrid Benefit, see the [ Azure Hybrid Benefit FAQ] [ 1 ] .
37
+
38
+ [ 1 ] : https://azure.microsoft.com/pricing/hybrid-benefit/#faq
18
39
19
40
## RECOMMENDATION
20
41
21
- Consider using Azure Hybrid Benefit for eligible workloads.
42
+ Consider using Azure Hybrid Benefit for eligible virtual machine (VM) workloads.
22
43
23
44
## EXAMPLES
24
45
@@ -34,44 +55,50 @@ For example:
34
55
35
56
``` json
36
57
{
37
- "type" : " Microsoft.Compute/virtualMachines" ,
38
- "apiVersion" : " 2021-07-01" ,
39
- "name" : " [parameters('name')]" ,
40
- "location" : " [parameters('location')]" ,
41
- "properties" : {
42
- "hardwareProfile" : {
43
- "vmSize" : " Standard_D2s_v3"
44
- },
45
- "osProfile" : {
46
- "computerName" : " [parameters('name')]" ,
47
- "adminUsername" : " [parameters('adminUsername')]" ,
48
- "adminPassword" : " [parameters('adminPassword')]"
49
- },
50
- "storageProfile" : {
51
- "imageReference" : {
52
- "publisher" : " MicrosoftWindowsServer" ,
53
- "offer" : " WindowsServer" ,
54
- "sku" : " [parameters('sku')]" ,
55
- "version" : " latest"
56
- },
57
- "osDisk" : {
58
- "name" : " [format('{0}-disk0', parameters('name'))]" ,
59
- "caching" : " ReadWrite" ,
60
- "createOption" : " FromImage"
61
- }
62
- },
63
- "licenseType" : " Windows_Server" ,
64
- "networkProfile" : {
65
- "networkInterfaces" : [
66
- {
67
- "id" : " [resourceId('Microsoft.Network/networkInterfaces', format('{0}-nic0', parameters('name')))]"
68
- }
69
- ]
58
+ "type" : " Microsoft.Compute/virtualMachines" ,
59
+ "apiVersion" : " 2023-09-01" ,
60
+ "name" : " [parameters('name')]" ,
61
+ "location" : " [parameters('location')]" ,
62
+ "zones" : [
63
+ " 1"
64
+ ],
65
+ "properties" : {
66
+ "hardwareProfile" : {
67
+ "vmSize" : " Standard_D2s_v3"
68
+ },
69
+ "osProfile" : {
70
+ "computerName" : " [parameters('name')]" ,
71
+ "adminUsername" : " [parameters('adminUsername')]" ,
72
+ "adminPassword" : " [parameters('adminPassword')]"
73
+ },
74
+ "storageProfile" : {
75
+ "imageReference" : {
76
+ "publisher" : " MicrosoftWindowsServer" ,
77
+ "offer" : " WindowsServer" ,
78
+ "sku" : " [parameters('sku')]" ,
79
+ "version" : " latest"
80
+ },
81
+ "osDisk" : {
82
+ "name" : " [format('{0}-disk0', parameters('name'))]" ,
83
+ "caching" : " ReadWrite" ,
84
+ "createOption" : " FromImage" ,
85
+ "managedDisk" : {
86
+ "storageAccountType" : " Premium_LRS"
70
87
}
88
+ }
71
89
},
72
- "dependsOn" : [
73
- " [resourceId('Microsoft.Network/networkInterfaces', format('{0}-nic0', parameters('name')))]"
74
- ]
90
+ "licenseType" : " Windows_Server" ,
91
+ "networkProfile" : {
92
+ "networkInterfaces" : [
93
+ {
94
+ "id" : " [resourceId('Microsoft.Network/networkInterfaces', parameters('nicName'))]"
95
+ }
96
+ ]
97
+ }
98
+ },
99
+ "dependsOn" : [
100
+ " [resourceId('Microsoft.Network/networkInterfaces', parameters('nicName'))]"
101
+ ]
75
102
}
76
103
```
77
104
@@ -86,9 +113,12 @@ To deploy VMs that pass this rule:
86
113
For example:
87
114
88
115
``` bicep
89
- resource vm 'Microsoft.Compute/virtualMachines@2021-07 -01' = {
116
+ resource vm_with_benefit 'Microsoft.Compute/virtualMachines@2023-09 -01' = {
90
117
name: name
91
118
location: location
119
+ zones: [
120
+ '1'
121
+ ]
92
122
properties: {
93
123
hardwareProfile: {
94
124
vmSize: 'Standard_D2s_v3'
@@ -109,6 +139,9 @@ resource vm 'Microsoft.Compute/virtualMachines@2021-07-01' = {
109
139
name: '${name}-disk0'
110
140
caching: 'ReadWrite'
111
141
createOption: 'FromImage'
142
+ managedDisk: {
143
+ storageAccountType: 'Premium_LRS'
144
+ }
112
145
}
113
146
}
114
147
licenseType: 'Windows_Server'
@@ -129,8 +162,26 @@ resource vm 'Microsoft.Compute/virtualMachines@2021-07-01' = {
129
162
az vm update -n ' <name>' -g ' <resource_group>' --set licenseType=Windows_Server
130
163
```
131
164
165
+ ### NOTES
166
+
167
+ This rule is not processed by default.
168
+ To enable this rule, set the ` AZURE_VM_USE_AZURE_HYBRID_BENEFIT ` configuration value to ` true ` .
169
+
170
+ For example:
171
+
172
+ ``` yaml title="ps-rule.yaml"
173
+ configuration :
174
+ AZURE_VM_USE_AZURE_HYBRID_BENEFIT : true
175
+ ` ` `
176
+
177
+ The following limitations currently apply:
178
+
179
+ - This rule only applies to Azure Hybrid Benefit for Windows VMs.
180
+ Linux VM images are ignored.
181
+
132
182
## LINKS
133
183
134
- - [ Design review checklist for Cost Optimization ] ( https://learn.microsoft.com/azure/well-architected/cost-optimization/checklist )
135
- - [ Azure Hybrid Benefit FAQ] ( https://azure.microsoft.com/pricing/hybrid-benefit/faq/ )
184
+ - [CO:05 Rate optimization ](https://learn.microsoft.com/azure/well-architected/cost-optimization/get-best-rates )
185
+ - [Azure Hybrid Benefit FAQ](https://azure.microsoft.com/pricing/hybrid-benefit/# faq)
136
186
- [Explore Azure Hybrid Benefit for Windows VMs](https://learn.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing)
187
+ - [Azure deployment reference](https://learn.microsoft.com/azure/templates/microsoft.compute/virtualmachines)
0 commit comments