Gallery › Service Bus › Azure Community Policy
Service Bus Namespace - Trusted Microsoft Services DENY
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
This Azure Policy denies the creation of a Service Bus Namespace when the 'Allow trusted Microsoft services to bypass this firewall?' setting is set to 'Yes'.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 45 lines
{
"name": "f4818b78-a565-424f-a614-78f233a9e50f",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Service Bus Namespace - Trusted Microsoft Services DENY",
"description": "This Azure Policy denies the creation of a Service Bus Namespace when the 'Allow trusted Microsoft services to bypass this firewall?' setting is set to 'Yes'.",
"metadata": {
"version": "1.0.0",
"category": "Service Bus"
},
"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.ServiceBus/namespaces/networkRuleSets"
},
{
"field": "Microsoft.ServiceBus/namespaces/networkRuleSets/trustedServiceAccessEnabled",
"equals": "true"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylawf4818b78-a565-424f-a614-78f233a9e50f.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy 'f4818b78-a565-424f-a614-78f233a9e50f' {
Properties @{
DisplayName = 'Service Bus Namespace - Trusted Microsoft Services DENY'
Description = 'This Azure Policy denies the creation of a Service Bus Namespace when the ''Allow trusted Microsoft services to bypass this firewall?'' setting is set to ''Yes''.'
Version = '1.0.0'
Category = 'Service Bus'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Deny', 'Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Deny, Audit or Disabled the execution of the Policy'
}
Resource 'Microsoft.ServiceBus/namespaces/networkRuleSets' {
Require 'trustedServiceAccessEnabled is not true' {
Field trustedServiceAccessEnabled | Must -Not -Be 'true' -IfPresent
}
}
Effect (Param Effect)
}Source: policyDefinitions/Service Bus/service-bus-namespace-trusted-microsoft-services-deny/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw