Bylaw

Gallery › App Service › Azure built-in policies

[Deprecated]: Ensure that '.NET Framework' version is the latest, if used as a part of the Web app

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 1.0.0-deprecated Deprecated

This policy is not required since Azure App Service automatically updates and maintains the .NET Framework versions installed on the platform.

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

Azure Policy JSONWebapp_Audit_NETFrameWork_Latest.json · 60 lines
{
  "properties": {
    "displayName": "[Deprecated]: Ensure that '.NET Framework' version is the latest, if used as a part of the Web app",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy is not required since Azure App Service automatically updates and maintains the .NET Framework versions installed on the platform.",
    "metadata": {
      "version": "1.0.0-deprecated",
      "category": "App Service",
      "deprecated": true
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "AuditIfNotExists",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Web/sites"
          },
          {
            "field": "kind",
            "like": "app*"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Web/sites/config",
          "existenceCondition": {
            "field": "Microsoft.Web/sites/config/web.netFrameworkVersion",
            "in": [
              "v3.0",
              "v4.0"
            ]
          }
        }
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/843664e0-7563-41ee-a9cb-7522c382d2c4",
  "name": "843664e0-7563-41ee-a9cb-7522c382d2c4"
}
Bylaw843664e0-7563-41ee-a9cb-7522c382d2c4.bylaw.ps1 · 34 lines
# Converted from Webapp_Audit_NETFrameWork_Latest.json by ConvertTo-Bylaw.
Policy '843664e0-7563-41ee-a9cb-7522c382d2c4' {

    Properties @{
        DisplayName   = '[Deprecated]: Ensure that ''.NET Framework'' version is the latest, if used as a part of the Web app'
        Description   = 'This policy is not required since Azure App Service automatically updates and maintains the .NET Framework versions installed on the platform.'
        Version       = '1.0.0-deprecated'
        Category      = 'App Service'
        Deprecated    = $true
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Web/sites' {

        Require 'kind is not like app*' {
            Field kind | Must -Not -BeLike 'app*' -IfPresent
        }
    }

    AuditIfNotExists 'Microsoft.Web/sites/config' -Effect (Param Effect) {
        Require 'web.netFrameworkVersion is one of 2 values' {
            Field web.netFrameworkVersion | Must -BeIn @('v3.0', 'v4.0')
        }
    }
}

Source: built-in-policies/policyDefinitions/App Service/Webapp_Audit_NETFrameWork_Latest.json in Azure/azure-policy, under the MIT licence.