Bylaw

Gallery › BuiltInPolicyTest › Azure built-in policies

[Deprecated]: Azure Machine Learning Model Registry Deployments are restricted except for the allowed Registry. Versioning Test BuiltIn.

Doesn't convert yet Policy Deny Disabled Mode Microsoft.MachineLearningServices.v2.Data Version 2.2.0-deprecated Deprecated

Only deploy Registry Models in the allowed Registry and that are not restricted.

ConvertTo-Bylaw can't convert this policy yet:

Azure Policy JSONOnlyDeployAllowedRegistryModels_Deny_Versioning_Test.json · 99 lines
{
  "properties": {
    "displayName": "[Deprecated]: Azure Machine Learning Model Registry Deployments are restricted except for the allowed Registry. Versioning Test BuiltIn.",
    "policyType": "BuiltIn",
    "mode": "Microsoft.MachineLearningServices.v2.Data",
    "description": "Only deploy Registry Models in the allowed Registry and that are not restricted.",
    "metadata": {
      "version": "2.2.0-deprecated",
      "category": "BuiltInPolicyTest",
      "deprecated": true
    },
    "version": "2.2.0",
    "parameters": {
      "allowedRegistryNameV2": {
        "type": "String",
        "defaultValue": "",
        "metadata": {
          "displayName": "Allowed Registry Name",
          "description": "The exact registry name where models are allowed to be deployed. If not set, by default all models from all registries will be restricted."
        }
      },
      "restrictedModels": {
        "type": "Array",
        "defaultValue": [],
        "metadata": {
          "displayName": "Restricted Model AssetIds",
          "description": "The list of Model AssetIds from the allowedRegistryName to be restricted from being deployed. If not set, by default all models from the allowedRegistryName will be allowed."
        }
      },
      "effect": {
        "type": "string",
        "allowedValues": [
          "Deny",
          "Disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "'Deny' restricts deploying the registry models except for the allowedRegistryName."
        },
        "defaultValue": "Disabled"
      },
      "testString": {
        "metadata": {
          "displayName": "Test string",
          "description": "A string to be compared against 'test' in the policy rule to generate the desired compliance result."
        },
        "type": "string",
        "defaultValue": "test"
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "value": "[parameters('testString')]",
            "equals": "test"
          },
          {
            "field": "type",
            "equals": "Microsoft.MachineLearningServices.v2.Data/workspaces/deployments"
          },
          {
            "anyOf": [
              {
                "field": "Microsoft.MachineLearningServices.v2.Data/workspaces/deployments/model.assetId",
                "in": "[parameters('restrictedModels')]"
              },
              {
                "allOf": [
                  {
                    "field": "Microsoft.MachineLearningServices.v2.Data/workspaces/deployments/model.assetId",
                    "like": "azureml://registries/*"
                  },
                  {
                    "not": {
                      "field": "Microsoft.MachineLearningServices.v2.Data/workspaces/deployments/model.assetId",
                      "like": "[concat('azureml://registries/', parameters('allowedRegistryNameV2'), '/*')]"
                    }
                  }
                ]
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]"
      }
    },
    "versions": [
      "2.2.0",
      "2.1.0",
      "2.0.0",
      "1.0.0"
    ]
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/85793e88-5a58-4555-93fa-4df63c86ae9c",
  "name": "85793e88-5a58-4555-93fa-4df63c86ae9c"
}

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