Gallery › Machine Learning › Azure built-in policies
Azure Machine Learning Compute Instance should have idle shutdown.
Converted Policy Audit Deny Disabled Mode All Version 1.0.0
Having an idle shutdown schedule reduces cost by shutting down computes that are idle after a pre-determined period of activity.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONIdleShutdown_Audit.json · 62 lines
{
"properties": {
"displayName": "Azure Machine Learning Compute Instance should have idle shutdown.",
"policyType": "BuiltIn",
"mode": "All",
"description": "Having an idle shutdown schedule reduces cost by shutting down computes that are idle after a pre-determined period of activity.",
"metadata": {
"version": "1.0.0",
"category": "Machine Learning"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"defaultValue": "Audit",
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "The effect determines what happens when the policy rule is evaluated to match."
}
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.MachineLearningServices/workspaces/computes"
},
{
"field": "Microsoft.MachineLearningServices/workspaces/computes/computeType",
"equals": "ComputeInstance"
},
{
"anyOf": [
{
"field": "Microsoft.MachineLearningServices/workspaces/computes/idleTimeBeforeShutdown",
"exists": false
},
{
"value": "[empty(field('Microsoft.MachineLearningServices/workspaces/computes/idleTimeBeforeShutdown'))]",
"equals": true
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/679ddf89-ab8f-48a5-9029-e76054077449",
"name": "679ddf89-ab8f-48a5-9029-e76054077449"
}Bylaw679ddf89-ab8f-48a5-9029-e76054077449.bylaw.ps1 · 36 lines
# Converted from IdleShutdown_Audit.json by ConvertTo-Bylaw.
Policy '679ddf89-ab8f-48a5-9029-e76054077449' {
Properties @{
DisplayName = 'Azure Machine Learning Compute Instance should have idle shutdown.'
Description = 'Having an idle shutdown schedule reduces cost by shutting down computes that are idle after a pre-determined period of activity.'
Version = '1.0.0'
Category = 'Machine Learning'
PolicyVersion = '1.0.0'
Mode = 'All'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'The effect determines what happens when the policy rule is evaluated to match.'
}
Resource 'Microsoft.MachineLearningServices/workspaces/computes' {
When {
Field computeType | Must -Be 'ComputeInstance'
}
Require 'idleTimeBeforeShutdown exists' {
Field idleTimeBeforeShutdown | Must -Exist
}
Require 'idleTimeBeforeShutdown is as required' {
Arm '[empty(field(''Microsoft.MachineLearningServices/workspaces/computes/idleTimeBeforeShutdown''))]' | Must -Not -Be $true
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Machine Learning/IdleShutdown_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw