Gallery › Network › Azure Community Policy
Audit loadbalancers with public ip
Converted Policy Audit Disabled Mode All Version 1.0.0
This policy audits if loadbalancers exists with public ip.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONazurepolicy.json · 44 lines
{
"name": "14ee2e98-6c35-4dca-8a29-8f80e86ce799",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Audit loadbalancers with public ip",
"description": "This policy audits if loadbalancers exists with public ip.",
"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.Network/loadBalancers"
},
{
"field": "Microsoft.Network/loadBalancers/frontendIPConfigurations[*].subnet.id",
"notLike": "*"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
}
}
}Bylaw14ee2e98-6c35-4dca-8a29-8f80e86ce799.bylaw.ps1 · 29 lines
# Converted from azurepolicy.json by ConvertTo-Bylaw.
Policy '14ee2e98-6c35-4dca-8a29-8f80e86ce799' {
Properties @{
DisplayName = 'Audit loadbalancers with public ip'
Description = 'This policy audits if loadbalancers exists with public ip.'
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.Network/loadBalancers' {
Require 'frontendIPConfigurations and subnet.id are as required' {
Count 'frontendIPConfigurations[*]' -Where {
Field subnet.id | Must -BeLike '*'
} | Must -Not -Be 0
}
}
Effect (Param Effect)
}Source: policyDefinitions/Network/audit-loadbalancers-with-public-ip/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw