Bylaw

Gallery › Machine Learning › Azure built-in policies

[Deprecated]: Azure Machine Learning workspaces should use private link

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

This policy is deprecated because private link is created after workspace creation, deny action can never succeed. Instead of continuing to use this policy, we recommend you instead assign this replacement policy with policy ID 45e05259-1eb5-4f70-9574-baf73e9d219b. Learn more about policy definition deprecation at aka.ms/policydefdeprecation.

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

Azure Policy JSONWorkspace_PrivateEndpoint_Audit.json · 57 lines
{
  "properties": {
    "displayName": "[Deprecated]: Azure Machine Learning workspaces should use private link",
    "policyType": "BuiltIn",
    "mode": "Indexed",
    "description": "This policy is deprecated because private link is created after workspace creation, deny action can never succeed. Instead of continuing to use this policy, we recommend you instead assign this replacement policy with policy ID 45e05259-1eb5-4f70-9574-baf73e9d219b. Learn more about policy definition deprecation at aka.ms/policydefdeprecation.",
    "metadata": {
      "version": "1.1.0-deprecated",
      "category": "Machine Learning",
      "deprecated": true
    },
    "version": "1.1.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.MachineLearningServices/workspaces"
          },
          {
            "count": {
              "field": "Microsoft.MachineLearningServices/workspaces/privateEndpointConnections[*]",
              "where": {
                "field": "Microsoft.MachineLearningServices/workspaces/privateEndpointConnections[*].privateLinkServiceConnectionState.status",
                "equals": "Approved"
              }
            },
            "less": 1
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "1.1.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/40cec1dd-a100-4920-b15b-3024fe8901ab",
  "name": "40cec1dd-a100-4920-b15b-3024fe8901ab"
}
Bylaw40cec1dd-a100-4920-b15b-3024fe8901ab.bylaw.ps1 · 31 lines
# Converted from Workspace_PrivateEndpoint_Audit.json by ConvertTo-Bylaw.
Policy '40cec1dd-a100-4920-b15b-3024fe8901ab' {

    Properties @{
        DisplayName   = '[Deprecated]: Azure Machine Learning workspaces should use private link'
        Description   = 'This policy is deprecated because private link is created after workspace creation, deny action can never succeed. Instead of continuing to use this policy, we recommend you instead assign this replacement policy with policy ID 45e05259-1eb5-4f70-9574-baf73e9d219b. Learn more about policy definition deprecation at aka.ms/policydefdeprecation.'
        Version       = '1.1.0-deprecated'
        Category      = 'Machine Learning'
        Deprecated    = $true
        PolicyVersion = '1.1.0'
        Mode          = 'Indexed'
    }

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

    Resource 'Microsoft.MachineLearningServices/workspaces' {

        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/Machine Learning/Workspace_PrivateEndpoint_Audit.json in Azure/azure-policy, under the MIT licence.