Azure / azure-monitor-baseline-alerts

Azure Monitor Baseline Alerts
MIT License
164 stars 239 forks source link

[Feedback]: Remediation for Deploy RV Backup Health Monitoring Alerts fails - MonitorSettings #348

Closed powershellpr0mpt closed 2 weeks ago

powershellpr0mpt commented 1 month ago

Check for previous/existing GitHub issues

Description

There seems to be an issue with remediation for this policy: Deploy_RecoveryVault_BackupHealthMonitor_Alert

When RSV's are non-compliant, a remediation task is not able to resolve this issue, as it keeps complaining about MonitorSettings.

When looking online, this is 100% similar to this issue: https://github.com/Azure/bicep-types-az/issues/2209

And seems to be caused by mandatory properties, which are required in newer versions of the API [but not yet documented]

When customizing the policy to add the following 3 MonitorSetting properties, the remediation is successfull as expected.

Can you please look into the remediation for this policy?

Brunoga-MS commented 1 month ago

Hello @powershellpr0mpt , thanks for your feedback. We will investigate furthermore and fix the issue. We'll keep you posted on the progress.

Thanks, Bruno.

Brunoga-MS commented 1 month ago

Hello @powershellpr0mpt , after further investigations I was not able to repro your issue. Could you please share how did you create the RSV? We are only aware of issues with RSV created via PowerShell and with specific API version.

Thanks, Bruno.

powershellpr0mpt commented 1 month ago

I'm trying to track down this information as this was at a specific customer. Not quite sure if this was deployed by us or them, will get back to you ASAP with this information, sorry for the delay!

powershellpr0mpt commented 1 month ago

Hi @Brunoga-MS , it turns out that at least some of these were recently created [august], using BICEP, using the AVM modules, specifically v0.3.0.

module vault 'br/public:avm/res/recovery-services/vault:0.3.0'

grazianosommariva commented 1 month ago

I have the same issue with: Deploy RV ASR Health Monitoring Alerts Failed to remediate resource: '/subscriptions/95119c4b-69c5-4e59-89fd-e2ec70a7d50c/resourceGroups/Mase-rg-backup/providers/Microsoft.RecoveryServices/vaults/vault-lxf2lbv8'. The 'PUT' request failed with status code: 'BadRequest'. Inner Error: 'monitoringSettings parameter is invalid. Please provide a valid monitoringSettings', Correlation Id: '112468e9-efd6-4b79-be01-cfd6c0480f92'.

Deploy RV Backup Health Monitoring Alerts

Failed to remediate resource: '/subscriptions/95119c4b-69c5-4e59-89fd-e2ec70a7d50c/resourceGroups/Mase-rg-backup/providers/Microsoft.RecoveryServices/vaults/vault-lxf2lbv8'. The 'PUT' request failed with status code: 'BadRequest'. Inner Error: 'monitoringSettings parameter is invalid. Please provide a valid monitoringSettings', Correlation Id: '81ddd0fb-73fd-4f7c-88f2-ad42c4997799'.

powershellpr0mpt commented 3 weeks ago

We found another customer where the RSV was created using a direct bicep using API version Microsoft.RecoveryServices/vaults@2023-01-01 . When looking at the bicep api info, it shows that this API also only had 2 properties under monitorSettings, causing the problem as shown.

Currently we have a workaround where we just manually change the json for this policy to add the properties as mentioned initially. Just to let you know it's not 'just' AVM module related.

Brunoga-MS commented 2 weeks ago

Hello @willewbank , Thanks for letting me know about the bicep as well. Since this is not an AMBA-ALZ policy problem and given that:

  1. a possible workaround has been provided (see #374 )
  2. an issue on the AVM repo to get this fixed has been created

I am closing this one.

Feel free to reopen it or to create a new one should be the case.

Thanks, Bruno.