Gallery › Machine Learning › Azure Landing Zones Library
Enforce subnet connectivity for Azure Machine Learning compute clusters and compute instances
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
Enforce subnet connectivity for Azure Machine Learning compute clusters and compute instances.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONDeny-MachineLearning-Compute-SubnetId.alz_policy_definition.json · 65 lines
{
"name": "Deny-MachineLearning-Compute-SubnetId",
"properties": {
"description": "Enforce subnet connectivity for Azure Machine Learning compute clusters and compute instances.",
"displayName": "Enforce subnet connectivity for Azure Machine Learning compute clusters and compute instances",
"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/computes",
"field": "type"
},
{
"field": "Microsoft.MachineLearningServices/workspaces/computes/computeType",
"in": [
"AmlCompute",
"ComputeInstance"
]
},
{
"anyOf": [
{
"exists": false,
"field": "Microsoft.MachineLearningServices/workspaces/computes/subnet.id"
},
{
"equals": true,
"value": "[empty(field('Microsoft.MachineLearningServices/workspaces/computes/subnet.id'))]"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"policyType": "Custom"
},
"type": "Microsoft.Authorization/policyDefinitions"
}BylawDeny-MachineLearning-Compute-SubnetId.bylaw.ps1 · 36 lines
# Converted from Deny-MachineLearning-Compute-SubnetId.alz_policy_definition.json by ConvertTo-Bylaw.
Policy 'Deny-MachineLearning-Compute-SubnetId' {
Properties @{
DisplayName = 'Enforce subnet connectivity for Azure Machine Learning compute clusters and compute instances'
Description = 'Enforce subnet connectivity for Azure Machine Learning compute clusters and compute instances.'
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/computes' {
When {
Field computeType | Must -BeIn @('AmlCompute', 'ComputeInstance')
}
Require 'subnet.id exists' {
Field subnet.id | Must -Exist
}
Require 'subnet.id is as required' {
Arm '[empty(field(''Microsoft.MachineLearningServices/workspaces/computes/subnet.id''))]' | Must -Not -Be $true
}
}
Effect (Param Effect)
}Source: policy_definitions/Deny-MachineLearning-Compute-SubnetId.alz_policy_definition.json in Azure/Azure-Landing-Zones-Library, under the MIT licence.
Bylaw