Bylaw

Gallery › Security Center › Azure built-in policies

[Deprecated]: Adaptive network hardening recommendations should be applied on internet facing virtual machines

Converted Policy AuditIfNotExists Disabled Mode Indexed Version 3.1.0-deprecated Deprecated

Azure Security Center recommends NSG rules for Internet-facing VMs. This policy is deprecated due to Azure Monitoring agent deprecation. Learn more at aka.ms/policydefdeprecation.

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

Azure Policy JSONASC_AdaptiveNetworkHardenings_Audit.json · 54 lines
{
  "properties": {
    "displayName": "[Deprecated]: Adaptive network hardening recommendations should be applied on internet facing virtual machines",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Azure Security Center recommends NSG rules for Internet-facing VMs. This policy is deprecated due to Azure Monitoring agent deprecation. Learn more at aka.ms/policydefdeprecation.",
    "metadata": {
      "version": "3.1.0-deprecated",
      "category": "Security Center",
      "deprecated": true
    },
    "version": "3.1.0",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Disabled",
        "allowedValues": [
          "AuditIfNotExists",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "field": "type",
        "equals": "Microsoft.Compute/virtualMachines"
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "type": "Microsoft.Security/assessments",
          "name": "f9f0eed0-f143-47bf-b856-671ea2eeed62",
          "existenceCondition": {
            "field": "Microsoft.Security/assessments/status.code",
            "in": [
              "NotApplicable",
              "Healthy"
            ]
          }
        }
      }
    },
    "versions": [
      "3.1.0",
      "3.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/08e6af2d-db70-460a-bfe9-d5bd474ba9d6",
  "name": "08e6af2d-db70-460a-bfe9-d5bd474ba9d6"
}
Bylaw08e6af2d-db70-460a-bfe9-d5bd474ba9d6.bylaw.ps1 · 29 lines
# Converted from ASC_AdaptiveNetworkHardenings_Audit.json by ConvertTo-Bylaw.
Policy '08e6af2d-db70-460a-bfe9-d5bd474ba9d6' {

    Properties @{
        DisplayName   = '[Deprecated]: Adaptive network hardening recommendations should be applied on internet facing virtual machines'
        Description   = 'Azure Security Center recommends NSG rules for Internet-facing VMs. This policy is deprecated due to Azure Monitoring agent deprecation. Learn more at aka.ms/policydefdeprecation.'
        Version       = '3.1.0-deprecated'
        Category      = 'Security Center'
        Deprecated    = $true
        PolicyVersion = '3.1.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Compute/virtualMachines'

    AuditIfNotExists 'Microsoft.Security/assessments' -Name 'f9f0eed0-f143-47bf-b856-671ea2eeed62' -Effect (Param Effect) {
        Require 'status.code is one of 2 values' {
            Field status.code | Must -BeIn @('NotApplicable', 'Healthy')
        }
    }
}

Source: built-in-policies/policyDefinitions/Security Center/ASC_AdaptiveNetworkHardenings_Audit.json in Azure/azure-policy, under the MIT licence.