Gallery › Managed Grafana › Azure built-in policies
Azure Managed Grafana workspaces should disable service account
Converted Policy Audit Deny Disabled Mode Indexed Version 1.0.0
Disables API keys and service account for automated workloads in Grafana workspace.
ConvertTo-Bylaw converted this policy, and proved that the file compiles back to the same definition.
Azure Policy JSONAMG_ServiceAccount_Deny.json · 50 lines
{
"properties": {
"displayName": "Azure Managed Grafana workspaces should disable service account",
"policyType": "BuiltIn",
"mode": "Indexed",
"description": "Disables API keys and service account for automated workloads in Grafana workspace.",
"metadata": {
"version": "1.0.0",
"category": "Managed Grafana"
},
"version": "1.0.0",
"parameters": {
"effect": {
"type": "String",
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy"
},
"allowedValues": [
"Audit",
"Deny",
"Disabled"
],
"defaultValue": "Audit"
}
},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Dashboard/grafana"
},
{
"field": "Microsoft.Dashboard/grafana/apiKey",
"notEquals": "Disabled"
}
]
},
"then": {
"effect": "[parameters('effect')]"
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/0656cf40-485c-427b-b992-703a4ecf4f88",
"name": "0656cf40-485c-427b-b992-703a4ecf4f88"
}Bylaw0656cf40-485c-427b-b992-703a4ecf4f88.bylaw.ps1 · 28 lines
# Converted from AMG_ServiceAccount_Deny.json by ConvertTo-Bylaw.
Policy '0656cf40-485c-427b-b992-703a4ecf4f88' {
Properties @{
DisplayName = 'Azure Managed Grafana workspaces should disable service account'
Description = 'Disables API keys and service account for automated workloads in Grafana workspace.'
Version = '1.0.0'
Category = 'Managed Grafana'
PolicyVersion = '1.0.0'
Mode = 'Indexed'
}
Parameter Effect @{
AllowedValues = @('Audit', 'Deny', 'Disabled')
Default = 'Audit'
DisplayName = 'Effect'
Description = 'Enable or disable the execution of the policy'
}
Resource 'Microsoft.Dashboard/grafana' {
Require 'apiKey is Disabled' {
Field apiKey | Must -Be 'Disabled'
}
}
Effect (Param Effect)
}Source: built-in-policies/policyDefinitions/Managed Grafana/AMG_ServiceAccount_Deny.json in Azure/azure-policy, under the MIT licence.
Bylaw