Skip to content

Instantly share code, notes, and snippets.

@tyconsulting
Last active May 6, 2022 18:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tyconsulting/14137eb880edf4397918a91f924b3b01 to your computer and use it in GitHub Desktop.
Save tyconsulting/14137eb880edf4397918a91f924b3b01 to your computer and use it in GitHub Desktop.
Append Hybrid Use Benefit
{
"type": "Microsoft.Authorization/policyDefinitions",
"name": "append-hybrid-use-benefit",
"properties": {
"displayName": "Append hybrid use benefit",
"description": "This policy will automatically configure hybrid use benefit for Windows Servers.",
"parameters": {},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"in": [
"Microsoft.Compute/virtualMachines",
"Microsoft.Compute/VirtualMachineScaleSets"
]
},
{
"field": "Microsoft.Compute/imagePublisher",
"equals": "MicrosoftWindowsServer"
},
{
"field": "Microsoft.Compute/imageOffer",
"equals": "WindowsServer"
},
{
"field": "Microsoft.Compute/imageSKU",
"in": [
"2008-R2-SP1",
"2008-R2-SP1-smalldisk",
"2012-Datacenter",
"2012-Datacenter-smalldisk",
"2012-R2-Datacenter",
"2012-R2-Datacenter-smalldisk",
"2016-Datacenter",
"2016-Datacenter-Server-Core",
"2016-Datacenter-Server-Core-smalldisk",
"2016-Datacenter-smalldisk",
"2016-Datacenter-with-Containers",
"2016-Datacenter-with-RDSH"
]
},
{
"field": "Microsoft.Compute/licenseType",
"notEquals": "Windows_Server"
}
]
},
"then": {
"effect": "append",
"details": [
{
"field": "Microsoft.Compute/licenseType",
"value": "Windows_Server"
}
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment