Community-Policy/policyDefinitions/Compute/enforce-hybrid-use-benefit
..
README.md
azurepolicy.json
azurepolicy.parameters.json
azurepolicy.rules.json

README.md

Enforce hybrid use benefit

This policy will enforce usage of hybrid use benefit.

Try on Portal

Deploy to Azure

Try with PowerShell

$definition = New-AzPolicyDefinition -Name "enforce-hybrid-use-benefit" -DisplayName "Enforce hybrid use benefit" -description "This policy will enforce usage of hybrid use benefit." -Policy 'https://raw.githubusercontent.com/Azure/azure-policy/master/samples/Compute/enforce-hybrid-use-benefit/azurepolicy.rules.json' -Parameter 'https://raw.githubusercontent.com/Azure/azure-policy/master/samples/Compute/enforce-hybrid-use-benefit/azurepolicy.parameters.json' -Mode All
$definition
$assignment = New-AzPolicyAssignment -Name <assignmentname> -Scope <scope>  -PolicyDefinition $definition
$assignment 

Try with CLI


az policy definition create --name 'enforce-hybrid-use-benefit' --display-name 'Enforce hybrid use benefit' --description 'This policy will enforce usage of hybrid use benefit.' --rules 'https://raw.githubusercontent.com/Azure/azure-policy/master/samples/Compute/enforce-hybrid-use-benefit/azurepolicy.rules.json' --params 'https://raw.githubusercontent.com/Azure/azure-policy/master/samples/Compute/enforce-hybrid-use-benefit/azurepolicy.parameters.json' --mode All

az policy assignment create --name <assignmentname> --scope <scope> --policy "enforce-hybrid-use-benefit"