Bylaw

Gallery › Mission › Azure built-in policies

Azure Virtual Desktop Host Pools should restrict RDP property configurations

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Ensures that Azure Virtual Desktop Host Pools enforce approved RDP property configurations, reducing the attack surface by limiting remote desktop protocol settings.

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

Azure Policy JSONAVDConfigRDPProps_Audit.json · 65 lines
{
  "properties": {
    "displayName": "Azure Virtual Desktop Host Pools should restrict RDP property configurations",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Ensures that Azure Virtual Desktop Host Pools enforce approved RDP property configurations, reducing the attack surface by limiting remote desktop protocol settings.",
    "metadata": {
      "version": "1.0.0",
      "category": "Mission"
    },
    "version": "1.0.0",
    "parameters": {
      "effect": {
        "type": "String",
        "metadata": {
          "displayName": "Effect",
          "description": " The desired effect of the policy."
        },
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "defaultValue": "Audit"
      },
      "requiredRdpProperties": {
        "type": "Array",
        "defaultValue": [],
        "metadata": {
          "displayName": "Required RDP Properties",
          "description": "List of required RDP properties to enforce on host pools"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.DesktopVirtualization/hostPools"
          },
          {
            "count": {
              "value": "[parameters('requiredRdpProperties')]",
              "name": "property",
              "where": {
                "value": "[current('property')]",
                "notin": "[split(field('Microsoft.DesktopVirtualization/hostPools/customRdpProperty'),';')]"
              }
            },
            "greater": 0
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/f0a5beeb-4b9b-4a3f-ba85-4f4b06afb598",
  "name": "f0a5beeb-4b9b-4a3f-ba85-4f4b06afb598"
}
Bylawf0a5beeb-4b9b-4a3f-ba85-4f4b06afb598.bylaw.ps1 · 36 lines
# Converted from AVDConfigRDPProps_Audit.json by ConvertTo-Bylaw.
Policy 'f0a5beeb-4b9b-4a3f-ba85-4f4b06afb598' {

    Properties @{
        DisplayName   = 'Azure Virtual Desktop Host Pools should restrict RDP property configurations'
        Description   = 'This policy applies exclusively to Mission Platform products and services; usage outside of these scopes is not supported. Ensures that Azure Virtual Desktop Host Pools enforce approved RDP property configurations, reducing the attack surface by limiting remote desktop protocol settings.'
        Version       = '1.0.0'
        Category      = 'Mission'
        PolicyVersion = '1.0.0'
        Mode          = 'Indexed'
    }

    Parameter Effect @{
        AllowedValues = @('Audit', 'Deny', 'Disabled')
        Default       = 'Audit'
        DisplayName   = 'Effect'
        Description   = ' The desired effect of the policy.'
    }
    Parameter RequiredRdpProperties @{
        Type        = 'Array'
        Default     = @()
        DisplayName = 'Required RDP Properties'
        Description = 'List of required RDP properties to enforce on host pools'
    }

    Resource 'Microsoft.DesktopVirtualization/hostPools' {

        Require 'customRdpProperty is as required' {
            Count -Value (Param RequiredRdpProperties) -Name property -Where {
                Current property | Must -Not -BeIn (Arm '[split(field(''Microsoft.DesktopVirtualization/hostPools/customRdpProperty''),'';'')]')
            } | Must -Be 0
        }
    }

    Effect (Param Effect)
}

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