Gallery › Service Bus › Azure built-in policies
Service Bus Namespaces should disable public network access
Converted Policy Audit Deny Disabled Mode All Version 1.1.0
Azure Service Bus 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/service-bus-messaging/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": "Service Bus Namespaces should disable public network access",
"policyType": "BuiltIn",
"mode": "All",
"description": "Azure Service Bus 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/service-bus-messaging/private-link-service",
"metadata": {
"version": "1.1.0",
"category": "Service Bus"
},
"version": "1.1.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.ServiceBus/namespaces/networkRuleSets",
"field": "type"
},
{
"notEquals": "Disabled",
"field": "Microsoft.ServiceBus/namespaces/networkRuleSets/publicNetworkAccess"
}
]
},
{
"allOf": [
{
"equals": "Microsoft.ServiceBus/namespaces",
"field": "type"
},
{
"notEquals": "Disabled",
"field": "Microsoft.ServiceBus/namespaces/publicNetworkAccess"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.1.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/cbd11fd3-3002-4907-b6c8-579f0e700e13",
"name": "cbd11fd3-3002-4907-b6c8-579f0e700e13"
}Bylawcbd11fd3-3002-4907-b6c8-579f0e700e13.bylaw.ps1 · 38 lines
# Converted from AuditPublicNetworkAccess.json by ConvertTo-Bylaw.
Policy 'cbd11fd3-3002-4907-b6c8-579f0e700e13' {
Properties @{
DisplayName = 'Service Bus Namespaces should disable public network access'
Description = 'Azure Service Bus 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/service-bus-messaging/private-link-service'
Version = '1.1.0'
Category = 'Service Bus'
PolicyVersion = '1.1.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.ServiceBus/namespaces/networkRuleSets' -IfPresent
Field 'Microsoft.ServiceBus/namespaces/networkRuleSets/publicNetworkAccess' | Must -Be 'Disabled'
}
}
Require 'type and publicNetworkAccess are as required' {
AnyOf {
Field type | Must -Not -Be 'Microsoft.ServiceBus/namespaces' -IfPresent
Field 'Microsoft.ServiceBus/namespaces/publicNetworkAccess' | Must -Be 'Disabled'
}
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Service Bus/AuditPublicNetworkAccess.json in Azure/azure-policy, under the MIT licence.
Bylaw