Parameters/Evaluation: Configure diagnostic settings for storage accounts to Log Analytics workspace
- Dominant language
- Open Policy Agent
- Stars
- 1.7k
- Forks
- 1.2k
- Avg merge
- 2d 54m
- Merged PRs (30d)
- 3
Description
#### Details of the scenario you tried and the problem that is occurring
The policy does actually not enforce the configuration which the parameters suggest it will do.
The policy actually checks for the Diagnostic Setting on the Storage Account level only but not on the specific storage services ( blobServices, fileServices, tableServices, queueServices). Because of that the Storage Account get compliant as son as the Diagnostic Settings on the Storage Account is created.
So assuming I want to ensure that the Diagnostic Settings is configured at Storage Account level and for all storage services I would assign the Policy with the default Parameters.
Now assume we have a Storage account which has a Diagnostic Setting as follows:


By the description and parameters of the Policy we now would expect that the Storage Account get evaluated as "Not Compliant" because the Diagnostic Settings for blob, queue, table and file are disabled which is not what we want.
But what instead actually happens ist that the Storage Account gets evaluated as "Compliant" because only the Diagnostic Settings at the top - Storage Account level get evaluated by the Policy but not these on the the particular storage service.
#### Verbose logs showing the problem
N/A
#### Suggested solution to the issue
- Either: The `existenceCondition` rule should be rewritten so it checks the Diagnostic Settings not only in the `Microsoft.Storage/storageAccounts` resource itself but also on the `Microsoft.Storage/storageAccounts/blobServices`, `Microsoft.Storage/storageAccounts/fileServices`,`Microsoft.Storage/storageAccounts/tableServices`, and `Microsoft.Storage/storageAccounts/queueServices` Sub-Resources.
If possible. I think the corresponding Policy Aliases are currently missing for doing that.
- Or: Or: Split the Policy in one Policy per Storage Service type.
Any way the Policy should be rewritten so it actually checks if **all** of the desired Diagnostic Settings are really configured.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the policy sample identified in the issue title and inspect its existenceCondition and diagnostic-settings parameters. Check whether evaluation covers the storage account and the blob, file, table, and queue service sub-resources, and verify the available Azure Policy aliases. Done means the policy reports non-compliance when any requested storage-service diagnostic setting is missing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure
- Domain
- cloud, observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100