Bylaw

Gallery › Mission › Azure built-in policies

Do not allow delete on App network configuration

Converted Policy DenyAction Disabled Mode All Version 1.0.0

This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Deny Deleting of Network Configuration of Apps.

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

Azure Policy JSONAppDenyNetDelete_DenyAction.json · 46 lines
{
  "properties": {
    "displayName": "Do not allow delete on App network configuration",
    "policyType": "BuiltIn",
    "mode": "All",
    "description": "This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Deny Deleting of Network Configuration of Apps.",
    "metadata": {
      "version": "1.0.0",
      "category": "Mission"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "DenyAction",
          "Disabled"
        ],
        "defaultValue": "DenyAction"
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.Web/sites/networkConfig"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "actionNames": [
            "delete"
          ]
        }
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/1d1e7723-ab70-4ce1-a12e-bf6977859d06",
  "name": "1d1e7723-ab70-4ce1-a12e-bf6977859d06"
}
Bylaw1d1e7723-ab70-4ce1-a12e-bf6977859d06.bylaw.ps1 · 23 lines
# Converted from AppDenyNetDelete_DenyAction.json by ConvertTo-Bylaw.
Policy '1d1e7723-ab70-4ce1-a12e-bf6977859d06' {

    Properties @{
        DisplayName   = 'Do not allow delete on App network configuration'
        Description   = 'This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Deny Deleting of Network Configuration of Apps.'
        Version       = '1.0.0'
        Category      = 'Mission'
        PolicyVersion = '1.0.0'
        Mode          = 'All'
    }

    Parameter Effect @{
        AllowedValues = @('DenyAction', 'Disabled')
        Default       = 'DenyAction'
        DisplayName   = 'Effect'
        Description   = 'Enable or disable the execution of the policy'
    }

    Resource 'Microsoft.Web/sites/networkConfig'

    DenyAction Delete -Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Mission/AppDenyNetDelete_DenyAction.json in Azure/azure-policy, under the MIT licence.