Bylaw

Gallery › SignalR › Azure built-in policies

[Deprecated]: Azure SignalR Service should use private link

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.1-deprecated Deprecated

The policy is deprecated. Please use /providers/Microsoft.Authorization/policyDefinitions/2393d2cf-a342-44cd-a2e2-fe0188fd1234 instead.

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

Azure Policy JSONPrivateEndpointEnabled_Audit_deprecated.json · 57 lines
{
  "properties": {
    "displayName": "[Deprecated]: Azure SignalR Service should use private link",
    "description": "The policy is deprecated. Please use /providers/Microsoft.Authorization/policyDefinitions/2393d2cf-a342-44cd-a2e2-fe0188fd1234 instead.",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "metadata": {
      "version": "1.0.1-deprecated",
      "category": "SignalR",
      "deprecated": true
    },
    "version": "1.0.1",
    "parameters": {
      "effect": {
        "type": "string",
        "defaultValue": "Audit",
        "allowedValues": [
          "Audit",
          "Deny",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy"
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "field": "type",
            "equals": "Microsoft.SignalRService/SignalR"
          },
          {
            "count": {
              "field": "Microsoft.SignalRService/SignalR/privateEndpointConnections[*]",
              "where": {
                "field": "Microsoft.SignalRService/SignalR/privateEndpointConnections[*].privateLinkServiceConnectionState.status",
                "equals": "Approved"
              }
            },
            "less": 1
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.0.1"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/53503636-bcc9-4748-9663-5348217f160f",
  "name": "53503636-bcc9-4748-9663-5348217f160f"
}
Bylaw53503636-bcc9-4748-9663-5348217f160f.bylaw.ps1 · 32 lines
# Converted from PrivateEndpointEnabled_Audit_deprecated.json by ConvertTo-Bylaw.
Policy '53503636-bcc9-4748-9663-5348217f160f' {

    Properties @{
        DisplayName   = '[Deprecated]: Azure SignalR Service should use private link'
        Description   = 'The policy is deprecated. Please use /providers/Microsoft.Authorization/policyDefinitions/2393d2cf-a342-44cd-a2e2-fe0188fd1234 instead.'
        Version       = '1.0.1-deprecated'
        Category      = 'SignalR'
        Deprecated    = $true
        PolicyVersion = '1.0.1'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.SignalRService/SignalR' {

        Require 'privateEndpointConnections and privateLinkServiceConnectionState.status are as required' {
            Count 'privateEndpointConnections[*]' -Where {
                Field privateLinkServiceConnectionState.status | Must -Be 'Approved'
            } | Must -BeGreaterOrEqual 1
        }
    }

    Effect (Param Effect)
}

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