Gallery › Event Hub › Azure Community Policy
Deny - Configure Event Hubs to allow only certain SKUs
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
The policy denies the Basic SKU because one can only create private endpoint connections with Standard or Premium SKU.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 56 lines
{
"name": "ef3bdb07-fc6c-4901-a49d-aeb376f65caf",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Deny - Configure Event Hubs to allow only certain SKUs",
"description": "The policy denies the Basic SKU because one can only create private endpoint connections with Standard or Premium SKU.",
"metadata": {
"category": "Event Hub",
"version": "1.0.0"
},
"mode": "All",
"parameters": {
"allowedSkuNames": {
"type": "Array",
"metadata": {
"displayName": "Allowed SKU Names",
"description": "Specifies the allowed SKU names."
},
"defaultValue": [
"Standard",
"Premium"
]
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Deny, Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.EventHub/namespaces"
},
{
"field": "Microsoft.EventHub/namespaces/sku.name",
"notIn": "[parameters('allowedSkuNames')]"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylawef3bdb07-fc6c-4901-a49d-aeb376f65caf.bylaw.ps1 · 33 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'ef3bdb07-fc6c-4901-a49d-aeb376f65caf' {
Properties @{
DisplayName = 'Deny - Configure Event Hubs to allow only certain SKUs'
Description = 'The policy denies the Basic SKU because one can only create private endpoint connections with Standard or Premium SKU.'
Category = 'Event Hub'
Version = '1.0.0'
Mode = 'All'
}
Parameter AllowedSkuNames @{
Type = 'Array'
Default = @('Standard', 'Premium')
DisplayName = 'Allowed SKU Names'
Description = 'Specifies the allowed SKU names.'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Deny, Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.EventHub/namespaces' {
Require 'sku.name is one of the AllowedSkuNames parameter' {
Field sku.name | Must -BeIn (Param AllowedSkuNames)
}
}
Effect (Param Effect)
}Source: policyDefinitions/Event Hub/deny-configure-event-hubs-to-allow-only-certain-skus/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw