Bylaw

Gallery › Machine Learning › Azure Landing Zones Library

Enforces high business impact Azure Machine Learning Workspaces

Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0

Enforces high business impact Azure Machine Learning workspaces.

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

Azure Policy JSONDeny-MachineLearning-HbiWorkspace.alz_policy_definition.json · 58 lines
{
  "name": "Deny-MachineLearning-HbiWorkspace",
  "properties": {
    "description": "Enforces high business impact Azure Machine Learning workspaces.",
    "displayName": "Enforces high business impact Azure Machine Learning Workspaces",
    "metadata": {
      "alzCloudEnvironments": [
        "AzureCloud"
      ],
      "category": "Machine Learning",
      "source": "https://github.com/Azure/Enterprise-Scale/",
      "version": "1.0.0"
    },
    "mode": "Indexed",
    "parameters": {
      "effect": {
        "allowedValues": [
          "Audit",
          "Disabled",
          "Deny"
        ],
        "defaultValue": "Deny",
        "metadata": {
          "description": "Enable or disable the execution of the policy",
          "displayName": "Effect"
        },
        "type": "String"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "equals": "Microsoft.MachineLearningServices/workspaces",
            "field": "type"
          },
          {
            "anyOf": [
              {
                "exists": false,
                "field": "Microsoft.MachineLearningServices/workspaces/hbiWorkspace"
              },
              {
                "field": "Microsoft.MachineLearningServices/workspaces/hbiWorkspace",
                "notEquals": true
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "policyType": "Custom"
  },
  "type": "Microsoft.Authorization/policyDefinitions"
}
BylawDeny-MachineLearning-HbiWorkspace.bylaw.ps1 · 32 lines
# Converted from Deny-MachineLearning-HbiWorkspace.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-MachineLearning-HbiWorkspace' {

    Properties @{
        DisplayName = 'Enforces high business impact Azure Machine Learning Workspaces'
        Description = 'Enforces high business impact Azure Machine Learning workspaces.'
        Category    = 'Machine Learning'
        Version     = '1.0.0'
        Mode        = 'Indexed'
        Metadata    = [ordered]@{ alzCloudEnvironments = @('AzureCloud'); source = 'https://github.com/Azure/Enterprise-Scale/' }
    }

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

    Resource 'Microsoft.MachineLearningServices/workspaces' {

        Require 'hbiWorkspace exists' {
            Field hbiWorkspace | Must -Exist
        }

        Require 'hbiWorkspace is true' {
            Field hbiWorkspace | Must -Be $true
        }
    }

    Effect (Param Effect)
}

Source: policy_definitions/Deny-MachineLearning-HbiWorkspace.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.