Bylaw

Gallery › Internet of Things › Azure built-in policies

IoT Hub device provisioning service instances should disable public network access

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Disabling public network access improves security by ensuring that IoT Hub device provisioning service instance isn't exposed on the public internet. Creating private endpoints can limit exposure of the IoT Hub device provisioning instances. Learn more at: https://aka.ms/iotdpsvnet.

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

Azure Policy JSONIoTDps_DisablePublicNetworkAccess_AuditDeny.json · 50 lines
{
  "properties": {
    "displayName": "IoT Hub device provisioning service instances should disable public network access",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "Disabling public network access improves security by ensuring that IoT Hub device provisioning service instance isn't exposed on the public internet. Creating private endpoints can limit exposure of the IoT Hub device provisioning instances. Learn more at: https://aka.ms/iotdpsvnet.",
    "metadata": {
      "version": "1.0.0",
      "category": "Internet of Things"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.Devices/provisioningServices"
          },
          {
            "field": "Microsoft.Devices/provisioningServices/publicNetworkAccess",
            "notEquals": "Disabled"
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/d82101f3-f3ce-4fc5-8708-4c09f4009546",
  "name": "d82101f3-f3ce-4fc5-8708-4c09f4009546"
}
Bylawd82101f3-f3ce-4fc5-8708-4c09f4009546.bylaw.ps1 · 28 lines
# Converted from IoTDps_DisablePublicNetworkAccess_AuditDeny.json by ConvertTo-Bylaw.
Policy 'd82101f3-f3ce-4fc5-8708-4c09f4009546' {

    Properties @{
        DisplayName   = 'IoT Hub device provisioning service instances should disable public network access'
        Description   = 'Disabling public network access improves security by ensuring that IoT Hub device provisioning service instance isn''t exposed on the public internet. Creating private endpoints can limit exposure of the IoT Hub device provisioning instances. Learn more at: https://aka.ms/iotdpsvnet.'
        Version       = '1.0.0'
        Category      = 'Internet of Things'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.Devices/provisioningServices' {

        Require 'publicNetworkAccess is Disabled' {
            Field publicNetworkAccess | Must -Be 'Disabled'
        }
    }

    Effect (Param Effect)
}

Source: built-in-policies/policyDefinitions/Internet of Things/IoTDps_DisablePublicNetworkAccess_AuditDeny.json in Azure/azure-policy, under the MIT licence.