Bylaw

Gallery › Sovereignty › Azure built-in policies

[Preview]: Azure Migrate projects should disable public network access

Converted Policy Audit Disabled Mode Indexed Version 1.0.0-preview Preview

Disabling public network access improves security by ensuring that Azure Migrate projects and assessment projects aren't exposed on the public internet.

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

Azure Policy JSONAzureMigrate_PublicNetworkAccess_Audit.json · 66 lines
{
  "properties": {
    "displayName": "[Preview]: Azure Migrate projects should disable public network access",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Disabling public network access improves security by ensuring that Azure Migrate projects and assessment projects aren't exposed on the public internet.",
    "metadata": {
      "version": "1.0.0-preview",
      "category": "Sovereignty",
      "preview": true
    },
    "version": "1.0.0-preview",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "anyOf": [
          {
            "allOf": [
              {
                "field": "type",
                "equals": "Microsoft.Migrate/migrateProjects"
              },
              {
                "field": "Microsoft.Migrate/migrateProjects/publicNetworkAccess",
                "notEquals": "Disabled"
              }
            ]
          },
          {
            "allOf": [
              {
                "field": "type",
                "equals": "Microsoft.Migrate/assessmentProjects"
              },
              {
                "field": "Microsoft.Migrate/assessmentProjects/publicNetworkAccess",
                "notEquals": "Disabled"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0-PREVIEW"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/e312c3b8-c565-45aa-9ddf-bec26b618285",
  "name": "e312c3b8-c565-45aa-9ddf-bec26b618285"
}
Bylawe312c3b8-c565-45aa-9ddf-bec26b618285.bylaw.ps1 · 39 lines
# Converted from AzureMigrate_PublicNetworkAccess_Audit.json by ConvertTo-Bylaw.
Policy 'e312c3b8-c565-45aa-9ddf-bec26b618285' {

    Properties @{
        DisplayName   = '[Preview]: Azure Migrate projects should disable public network access'
        Description   = 'Disabling public network access improves security by ensuring that Azure Migrate projects and assessment projects aren''t exposed on the public internet.'
        Version       = '1.0.0-preview'
        Category      = 'Sovereignty'
        Preview       = $true
        PolicyVersion = '1.0.0-preview'
        Mode          = 'Indexed'
    }

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

    Resource * {

        Require 'type and publicNetworkAccess are as required' {
            AnyOf {
                Field type | Must -Not -Be 'Microsoft.Migrate/migrateProjects' -IfPresent
                Field 'Microsoft.Migrate/migrateProjects/publicNetworkAccess' | Must -Be 'Disabled'
            }
        }

        Require 'type and publicNetworkAccess are as required' {
            AnyOf {
                Field type | Must -Not -Be 'Microsoft.Migrate/assessmentProjects' -IfPresent
                Field 'Microsoft.Migrate/assessmentProjects/publicNetworkAccess' | Must -Be 'Disabled'
            }
        }
    }

    Effect (Param Effect)
}

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