Gallery › Event Hub › Azure Community Policy
Deny - Configure Event Hubs to disable public network access
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
The policy denies accessing the resource through public network. Only private endpoints are supported.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 45 lines
{
"name": "3e33f017-b705-443c-95c0-71e707fef8d6",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Deny - Configure Event Hubs to disable public network access",
"description": "The policy denies accessing the resource through public network. Only private endpoints are supported.",
"metadata": {
"category": "Event Hub",
"version": "1.0.0"
},
"mode": "All",
"parameters": {
"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/publicNetworkAccess",
"notEquals": "Disabled"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw3e33f017-b705-443c-95c0-71e707fef8d6.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '3e33f017-b705-443c-95c0-71e707fef8d6' {
Properties @{
DisplayName = 'Deny - Configure Event Hubs to disable public network access'
Description = 'The policy denies accessing the resource through public network. Only private endpoints are supported.'
Category = 'Event Hub'
Version = '1.0.0'
Mode = 'All'
}
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 'publicNetworkAccess is Disabled' {
Field publicNetworkAccess | Must -Be 'Disabled'
}
}
Effect (Param Effect)
}Source: policyDefinitions/Event Hub/deny-configure-event-hubs-to-disable-public-network-access/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw