{
  "properties": {
    "displayName": "Configure allowed module authors for specified Azure Machine Learning computes",
    "policyType": "BuiltIn",
    "mode": "Microsoft.MachineLearningServices.Data",
    "description": "Provide allowed module authors in specified Azure Machine Learning computes and can be assigned at the workspace. For more information, visit https://aka.ms/amlpolicydoc.",
    "metadata": {
      "version": "2.1.0-preview",
      "category": "Machine Learning",
      "preview": true
    },
    "parameters": {
      "computeNames": {
        "type": "Array",
        "metadata": {
          "displayName": "Compute names where Azure ML jobs run",
          "description": "List of compute names where this policy should be applied. Ex. cpu-cluster;gpu-cluster. If no value is provided to this parameter then policy is applicable to all computes."
        },
        "defaultValue": []
      },
      "computeType": {
        "type": "String",
        "metadata": {
          "displayName": "Compute type for the compute where Azure ML jobs run",
          "description": "Compute type name. If Any is selected, the policy is applicable to any compute types."
        },
        "allowedValues": [
          "MachineLearningCompute",
          "AzureDataFactory",
          "HDInsight",
          "Any"
        ],
        "defaultValue": "Any"
      },
      "isIsolatedNetwork": {
        "type": "String",
        "metadata": {
          "displayName": "Is the compute in isolated network",
          "description": "Only applicable for MachineLearningCompute type. \"Yes: apply the policy to computes in isolated network\". \"No: apply the policy to computes that are out of isolated network\". \"Any: apply the policy regardless of if the compute is in isolated network or not\". If compute type is not MachineLearningCompute, the value set for this parameter will be ignored."
        },
        "allowedValues": [
          "Yes",
          "No",
          "Any"
        ],
        "defaultValue": "Any"
      },
      "allowedModuleAuthors": {
        "type": "Array",
        "metadata": {
          "displayName": "Allowed module authors",
          "description": "List of allowed module authors."
        },
        "defaultValue": []
      },
      "effect": {
        "type": "String",
        "defaultValue": "enforceSetting",
        "allowedValues": [
          "enforceSetting",
          "disabled"
        ],
        "metadata": {
          "displayName": "Effect",
          "description": "Enable or disable the execution of the policy."
        }
      }
    },
    "policyRule": {
      "if": {
        "allOf": [
          {
            "anyOf": [
              {
                "field": "Microsoft.MachineLearningServices.Data/workspaces/computes/name",
                "in": "[parameters('computeNames')]"
              },
              {
                "value": "[length(parameters('computeNames'))]",
                "equals": 0
              }
            ]
          },
          {
            "anyOf": [
              {
                "value": "[parameters('computeType')]",
                "equals": "Any"
              },
              {
                "field": "Microsoft.MachineLearningServices.Data/workspaces/computes/type",
                "equals": "[parameters('computeType')]"
              }
            ]
          },
          {
            "anyOf": [
              {
                "allOf": [
                  {
                    "field": "Microsoft.MachineLearningServices.Data/workspaces/computes/type",
                    "equals": "MachineLearningCompute"
                  },
                  {
                    "anyOf": [
                      {
                        "value": "[parameters('isIsolatedNetwork')]",
                        "equals": "Any"
                      },
                      {
                        "field": "Microsoft.MachineLearningServices.Data/workspaces/computes/isIsolatedNetwork",
                        "equals": "[parameters('isIsolatedNetwork')]"
                      }
                    ]
                  }
                ]
              },
              {
                "field": "Microsoft.MachineLearningServices.Data/workspaces/computes/type",
                "notEquals": "MachineLearningCompute"
              }
            ]
          }
        ]
      },
      "then": {
        "effect": "[parameters('effect')]",
        "details": {
          "setting": {
            "name": "allowedModuleAuthors",
            "value": "[parameters('allowedModuleAuthors')]"
          }
        }
      }
    }
  },
  "id": "/providers/Microsoft.Authorization/policyDefinitions/53c70b02-63dd-11ea-bc55-0242ac130003",
  "name": "53c70b02-63dd-11ea-bc55-0242ac130003"
}