Gallery › Event Hub › Azure built-in policies
Event Hub Namespaces should disable public network access
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
Azure Event Hub should have public network access disabled. Disabling public network access improves security by ensuring that the resource isn't exposed on the public internet. You can limit exposure of your resources by creating private endpoints instead. Learn more at: https://docs.microsoft.com/azure/event-hubs/private-link-service
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAuditPublicNetworkAccess.json · 66 lines
{
"properties": {
"displayName": "Event Hub Namespaces should disable public network access",
"policyType": "BuiltIn",
"mode": "All",
"description": "Azure Event Hub should have public network access disabled. Disabling public network access improves security by ensuring that the resource isn't exposed on the public internet. You can limit exposure of your resources by creating private endpoints instead. Learn more at: https://docs.microsoft.com/azure/event-hubs/private-link-service",
"metadata": {
"version": "1.0.0",
"category": "Event Hub"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "The desired effect of the policy."
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"anyOf": [
{
"allOf": [
{
"equals": "Microsoft.EventHub/namespaces/networkRuleSets",
"field": "type"
},
{
"notEquals": "Disabled",
"field": "Microsoft.EventHub/namespaces/networkRuleSets/publicNetworkAccess"
}
]
},
{
"allOf": [
{
"equals": "Microsoft.EventHub/namespaces",
"field": "type"
},
{
"notEquals": "Disabled",
"field": "Microsoft.EventHub/namespaces/publicNetworkAccess"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/0602787f-9896-402a-a6e1-39ee63ee435e",
"name": "0602787f-9896-402a-a6e1-39ee63ee435e"
}Bylaw0602787f-9896-402a-a6e1-39ee63ee435e.bylaw.ps1 · 38 lines
# Converted from AuditPublicNetworkAccess.json by ConvertTo-Bylaw.
Policy '0602787f-9896-402a-a6e1-39ee63ee435e' {
Properties @{
DisplayName = 'Event Hub Namespaces should disable public network access'
Description = 'Azure Event Hub should have public network access disabled. Disabling public network access improves security by ensuring that the resource isn''t exposed on the public internet. You can limit exposure of your resources by creating private endpoints instead. Learn more at: https://docs.microsoft.com/azure/event-hubs/private-link-service'
Version = '1.0.0'
Category = 'Event Hub'
PolicyVersion = '1.0.0'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'The desired effect of the policy.'
}
Resource * {
Require 'type and publicNetworkAccess are as required' {
AnyOf {
Field type | Must -Not -Be 'Microsoft.EventHub/namespaces/networkRuleSets' -IfPresent
Field 'Microsoft.EventHub/namespaces/networkRuleSets/publicNetworkAccess' | Must -Be 'Disabled'
}
}
Require 'type and publicNetworkAccess are as required' {
AnyOf {
Field type | Must -Not -Be 'Microsoft.EventHub/namespaces' -IfPresent
Field 'Microsoft.EventHub/namespaces/publicNetworkAccess' | Must -Be 'Disabled'
}
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Event Hub/AuditPublicNetworkAccess.json in Azure/azure-policy, under the MIT licence.
Bylaw