Gallery › Network › Azure Community Policy
modify-inject-Routes-into-exsiting-Route-Table
Doesn't convert yet Policy Audit Deny Disabled Modify Mode All Version 1.0.0
need to add description
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 · 93 lines
{
"name": "c9b6da2e-38d7-4fb8-90bf-ab48ba3b13ae",
"type": "Microsoft.Authorization/policyDefinitions",
"properties": {
"displayName": "modify-inject-Routes-into-exsiting-Route-Table",
"description": "need to add description",
"metadata": {
"version": "1.0.0",
"category": "Network"
},
"mode": "All",
"parameters": {
"addressPrefix": {
"type": "string",
"metadata": {
"description": "The destination IP address range in CIDR notation that this Policy checks for within the UDR. Example: 0.0.0.0/0 to check for the presence of a default route.",
"displayName": "Address Prefix"
}
},
"nextHopType": {
"type": "string",
"metadata": {
"description": "The next hope type that the policy checks for within the inspected route. The value can be Virtual Network, Virtual Network Gateway, Internet, Virtual Appliance, or None.",
"displayName": "Next Hop Type"
},
"allowedValues": [
"VnetLocal",
"VirtualNetworkGateway",
"Internet",
"VirtualAppliance",
"None"
]
},
"nextHopIpAddress": {
"type": "string",
"metadata": {
"description": "The IP address packets should be forwarded to.",
"displayName": "Next Hop IP Address"
}
},
"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"
}
]
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"roleDefinitionIds": [
"/providers/microsoft.authorization/roleDefinitions/4d97b98b-1d4f-4787-a291-c67834d212e7"
],
"conflictEffect": "audit",
"operations": [
{
"operation": "addOrReplace",
"field": "Microsoft.Network/routeTables/routes[*].addressPrefix",
"value": "[parameters('addressPrefix')]"
},
{
"operation": "addOrReplace",
"field": "Microsoft.Network/routeTables/routes[*].nextHopType",
"value": "[parameters('nextHopType')]"
},
{
"operation": "addOrReplace",
"field": "Microsoft.Network/routeTables/routes[*].nextHopIpAddress",
"value": "[parameters('nextHopIpAddress')]"
}
]
}
}
}
}
}Source: policyDefinitions/Network/modify-inject-routes-into-exsiting-route-table/azurepolicy.json in Azure/Community-Policy, under the MIT licence.
Bylaw