Bylaw

Gallery › Network › Azure Community Policy

audit-servicebus-namespaces-without-network-configuration

Converted Policy Audit Disabled Mode All Version 1.0.0

need to add description

ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.

Azure Policy JSONazurepolicy.json · 44 lines
{
  "name": "0e079cd7-242c-45c4-819e-2689e16173ae",
  "type": "Microsoft.Authorization/policyDefinitions",
  "properties": {
    "displayName": "audit-servicebus-namespaces-without-network-configuration",
    "description": "need to add description",
    "metadata": {
      "version": "1.0.0",
      "category": "Network"
    },
    "mode": "All",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Audit or Disabled the execution of the Policy"
        },
        "allowedValues": [
          "Audit",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.ServiceBus/namespaces/networkrulesets"
          },
          {
            "field": "Microsoft.ServiceBus/namespaces/networkrulesets/default.defaultAction",
            "notequals": "Deny"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    }
  }
}
Bylaw0e079cd7-242c-45c4-819e-2689e16173ae.bylaw.ps1 · 27 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '0e079cd7-242c-45c4-819e-2689e16173ae' {

    Properties @{
        DisplayName = 'audit-servicebus-namespaces-without-network-configuration'
        Description = 'need to add description'
        Version     = '1.0.0'
        Category    = 'Network'
        Mode        = 'All'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = 'Audit or Disabled the execution of the Policy'
    }

    Resource 'Microsoft.ServiceBus/namespaces/networkrulesets' {

        Require 'default.defaultAction is Deny' {
            Field default.defaultAction | Must -Be 'Deny'
        }
    }

    Effect (Param Effect)
}

Source: policyDefinitions/Network/audit-servicebus-namespaces-without-network-configuration/azurepolicy.json in Azure/Community-Policy, under the MIT licence.