Gallery › Automation › Azure built-in policies
Automation Account should have Managed Identity
Converted Policy Audit Disabled Mode Indexed Version 1.0.0
Use Managed Identities as the recommended method for authenticating with Azure resources from the runbooks. Managed identity for authentication is more secure and eliminates the management overhead associated with using RunAs Account in your runbook code .
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAccount_ManagedIdentity_Audit.json · 57 lines
{
"properties": {
"displayName": "Automation Account should have Managed Identity",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Use Managed Identities as the recommended method for authenticating with Azure resources from the runbooks. Managed identity for authentication is more secure and eliminates the management overhead associated with using RunAs Account in your runbook code .",
"metadata": {
"version": "1.0.0",
"category": "Automation"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Automation/automationAccounts"
},
{
"anyOf": [
{
"field": "identity.type",
"exists": "false"
},
{
"field": "identity.type",
"contains": "None"
}
]
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/dea83a72-443c-4292-83d5-54a2f98749c0",
"name": "dea83a72-443c-4292-83d5-54a2f98749c0"
}Bylawdea83a72-443c-4292-83d5-54a2f98749c0.bylaw.ps1 · 32 lines
# Converted from Account_ManagedIdentity_Audit.json by ConvertTo-Bylaw.
Policy 'dea83a72-443c-4292-83d5-54a2f98749c0' {
Properties @{
DisplayName = 'Automation Account should have Managed Identity'
Description = 'Use Managed Identities as the recommended method for authenticating with Azure resources from the runbooks. Managed identity for authentication is more secure and eliminates the management overhead associated with using RunAs Account in your runbook code .'
Version = '1.0.0'
Category = 'Automation'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Automation/automationAccounts' {
Require 'identity.type exists' {
Field identity.type | Must -Exist
}
Require 'identity.type does not contain None' {
Field identity.type | Must -Not -ContainText 'None' -IfPresent
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Automation/Account_ManagedIdentity_Audit.json in Azure/azure-policy, under the MIT licence.
Bylaw