Created
June 14, 2023 10:20
-
-
Save adammontlake/a7ca45d5e10a953d2e4475c54e6a6162 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"properties": { | |
"displayName": "storage-capacity-alert", | |
"policyType": "Custom", | |
"mode": "All", | |
"parameters": { | |
"metricName": { | |
"type": "String", | |
"metadata": { | |
"displayName": "Metric name", | |
"description": "The metric name that an alert rule nabmust be eled on. See https://docs.microsoft.com/en-us/azure/monitoring-and-diagnostics/monitoring-supported-metrics#microsoftbatchbatchaccounts for a list of metrics." | |
}, | |
"defaultValue": "Transactions" | |
} | |
}, | |
"policyRule": { | |
"if": { | |
"allOf": [ | |
{ | |
"field": "type", | |
"equals": "Microsoft.Storage/storageAccounts" | |
}, | |
{ | |
"field": "kind", | |
"equals": "FileStorage" | |
}, | |
{ | |
"field": "Microsoft.Storage/storageAccounts/sku.tier", | |
"equals": "Premium" | |
} | |
] | |
}, | |
"then": { | |
"effect": "AuditIfNotExists", | |
"details": { | |
"type": "Microsoft.Insights/metricAlerts", | |
"existenceScope": "Subscription", | |
"existenceCondition": { | |
"allOf": [ | |
{ | |
"field": "Microsoft.Insights/metricalerts/enabled", | |
"equals": "true" | |
}, | |
{ | |
"field": "Microsoft.Insights/metricAlerts/criteria.Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria.allOf[*].metricName", | |
"equals": "[parameters('metricName')]" | |
}, | |
{ | |
"field": "Microsoft.Insights/metricalerts/scopes[*]", | |
"equals": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name, '/providers/Microsoft.Storage/storageAccounts/', field('name'))]" | |
} | |
] | |
} | |
} | |
} | |
} | |
}, | |
"id": "/subscriptions/7d91561b-788f-465e-81aa-39409f1f6b3a/providers/Microsoft.Authorization/policyDefinitions/f9a14599-96d8-417f-b206-84e030dcd7df", | |
"type": "Microsoft.Authorization/policyDefinitions", | |
"name": "f9a14599-96d8-417f-b206-84e030dcd7df", | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment