Gallery › Network › Azure Community Policy
Adds route with address prefix 0.0.0.0/0 pointing to the virtual appliance in case there is none.
Doesn't convert yet Policy Audit Deny Disabled Modify Mode All Version 1.0.0
Adds route with address prefix 0.0.0.0/0 pointing to the virtual appliance in case there is none. Best combined with policy deny-route-nexthopvirtualappliance to ensure the correct IP address of the virtual appliance.
ConvertTo-Bylaw can't convert this policy yet:
- BYL6003 The converted file doesn't compile, which is a ConvertTo-Bylaw bug: BYL3062: Effect parameter 'Effect' of a Modify policy allows 'Deny'. Allowed values: Modify, Audit, Disabled. A Modify policy changes the request, so it never denies it.
Azure Policy JSONazurepolicy.json · 79 lines
{
"name": "1e1e6dd7-6c07-4de3-a273-aad9c6b24211",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "Adds route with address prefix 0.0.0.0/0 pointing to the virtual appliance in case there is none.",
"description": "Adds route with address prefix 0.0.0.0/0 pointing to the virtual appliance in case there is none. Best combined with policy deny-route-nexthopvirtualappliance to ensure the correct IP address of the virtual appliance.",
"metadata": {
"category": "Network",
"version": "1.0.0"
},
"mode": "All",
"parameters": {
"routeTableSettings": {
"type": "Object",
"metadata": {
"displayName": "Route Table Settings",
"description": "Location-specific settings for route tables."
}
},
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Modify, Deny, Audit or Disabled the execution of the Policy"
},
"allowedValues": [
"Modify",
"Deny",
"Audit",
"Disabled"
],
"defaultValue": "Modify"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Network/routeTables"
},
{
"count": {
"field": "Microsoft.Network/routeTables/routes[*]",
"where": {
"field": "Microsoft.Network/routeTables/routes[*].addressPrefix",
"equals": "0.0.0.0/0"
}
},
"equals": 0
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/4d97b98b-1d4f-4787-a291-c67834d212e7"
],
"conflictEffect": "audit",
"operations": [
{
"operation": "add",
"field": "Microsoft.Network/routeTables/routes[*]",
"value": {
"name": "default",
"properties": {
"addressPrefix": "0.0.0.0/0",
"nextHopType": "VirtualAppliance",
"nextHopIpAddress": "[parameters('routeTableSettings')[field('location')].virtualApplianceIpAddress]"
}
}
}
]
}
}
}
}
}Source: policyDefinitions/Network/adds-route-with-address-prefix-0.0.0.0-0-pointing-to-the-virtual-appliance-in-case-there-is-none/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw