Enterprise-Scale icon indicating copy to clipboard operation
Enterprise-Scale copied to clipboard

Remediation not working for policy Deploys NSG flow logs and traffic analytics to a storageaccountid with a specfied retention period.

Open neok-g opened this issue 2 years ago • 16 comments

Describe the bug Remediation for the policy 'Deploys NSG flow logs and traffic analytics to a storageaccountid with a specfied retention period.' does not work. The error is: Reason No policy evaluation result was found. The policy assignment's exclusions may have changed or it no longer exists. Please retry the remediation with 'ResourceDiscoveryMode' set to 'ReEvaluateCompliance'.

Steps to reproduce

  1. Deploy the policy definition and create an assignment
  2. Create a NSG without flowlogs configured
  3. NSG becomes non-compliant after a. while
  4. Create a remediation task. The task fails. with the error above and the NSG remains non-compliant.

Screenshots

neok-g avatar Jun 15 '22 08:06 neok-g

Thanks @neok-g for the issue.

Can you confirm the definition ID of the policy as we have 2 with the same description:

image https://www.azadvertizer.net/azpolicyadvertizer_all.html#%7B%22col_3%22%3A%7B%22flt%22%3A%22nsg%22%7D%2C%22col_10%22%3A%7B%22flt%22%3A%22ESLZ%22%7D%7D

Thanks

Jack

jtracey93 avatar Jun 15 '22 09:06 jtracey93

Hi @jtracey93

Thanks for your response. The policy definition ID of the policy we use is: /providers/Microsoft.Management/managementGroups/mg-pg-prd/providers/Microsoft.Authorization/policyDefinitions/Deploy-Nsg-FlowLogs

Thanks

neok-g avatar Jun 15 '22 11:06 neok-g

Any update on this one?

neok-g avatar Jun 23 '22 05:06 neok-g

@jtracey93 Do you need more input from my side? Are you able to reproduce this one?

neok-g avatar Jul 12 '22 05:07 neok-g

Hi @neok-g,

I think we are all good, just some time to investigate amongst some other items that we are working on.

Hopefully will get a chance to look this week 👍

jtracey93 avatar Jul 12 '22 08:07 jtracey93

@neok-g, are you able to test this version of the policy please and let us know if it works? https://www.azadvertizer.net/azpolicyadvertizer/Deploy-Nsg-FlowLogs-to-LA.html

jtracey93 avatar Jul 12 '22 08:07 jtracey93

@jtracey93 Thanks! I will take a look at it today

neok-g avatar Jul 13 '22 11:07 neok-g

Perfect @neok-g let us know how it goes

jtracey93 avatar Jul 13 '22 11:07 jtracey93

@jtracey93 I guess you shared the wrong one. We use the "Deploys NSG flow logs and traffic analytics" instead of "Deploys NSG flow logs and traffic analytics to Log Analytics" since we want provide our own storageaccount.

neok-g avatar Jul 13 '22 11:07 neok-g

Apologies @neok-g, was not aware that was your requirement.

Out of interest, I saw this built-in is now available https://www.azadvertizer.net/azpolicyadvertizer/5e1cd26a-5090-4fdb-9d6a-84a90335e22d.html

And it looks to be a pretty close match to what our custom policy does apart from its assigned to a region, but you can assign multiple times.

Just wondering if you could give this a go whilst i find some time to test our one to see if i can replicate your bug?

jtracey93 avatar Jul 13 '22 11:07 jtracey93

@jtracey93 No problem. The thing is we would like to specify retention period in combination with a self-chosen storage account. The only policy that seems to offer both is "Deploys NSG flow logs and traffic analytics". The built-in "Configure network security groups to use specific workspace for traffic analytics" has retention hardcoded 0 days and disabled.

neok-g avatar Jul 13 '22 12:07 neok-g

Any update on this one?

neok-g avatar Jul 19 '22 09:07 neok-g

Could you please provide an update on this one?

neok-g avatar Aug 30 '22 11:08 neok-g

Hey @neok-g,

We are awaiting to review and merge PR #1022 before working on these. We hope to review and merge this PR this week.

jtracey93 avatar Aug 30 '22 11:08 jtracey93

Trigger ADO Sync 1

jtracey93 avatar Sep 11 '22 07:09 jtracey93

Trigger ADO Sync 2

jtracey93 avatar Sep 11 '22 07:09 jtracey93

@neok-g been a long time since we've provided updates, apologies. Please note, we have deprecated the ALZ custom policies for "Deploy NSG flow logs *" and they have been superseded by the built-in policy https://www.azadvertizer.net/azpolicyadvertizer/e920df7f-9a64-4066-9b58-52684c02a091.html. This should address your issue.

Springstone avatar Oct 04 '23 04:10 Springstone