Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy Diagnostic Settings Policy - deployifnotexists fails on initial deployment #635

Closed
LouiseSimpson opened this issue Mar 1, 2023 · 8 comments

Comments

@LouiseSimpson
Copy link

Policy 'Deploy Diagnostic Settings for Activity Log to Log Analytics workspace'

On an initial deployment (when no Diagnostic settings for connectivity and management subscriptions exist), the Policy above fails to apply Diagnostic settings to the subscriptions.

An error is produced in the Subscription Activity Log:
Operation name 'deployIfNotExists' Policy action.
Event initiated by Microsoft Azure Policy Insights
"errorMessage": "Evaluation of DeployIfNotExists policy was unsuccessful. The policy assignment '/providers/Microsoft.Management/managementGroups/id/providers/Microsoft.Authorization/policyAssignments/Deploy-AzActivity-Log' resource identity does not have the necessary permissions to create deployment '/subscriptions/id/providers/Microsoft.Resources/deployments/PolicyDeployment_xxx'. Please see https://aka.ms/arm-policy-identity for usage details.",

If the subscription is subsequently moved out of its management group and then back in, the diagnostics settings are then applied correctly (triggered after 30 minutes).

@ghost ghost added the Needs: Triage 🔍 Needs triaging by the team label Mar 1, 2023
@LouiseSimpson
Copy link
Author

This is using terraform-azurerm-caf-enterprise-scale v2.4.0

@jtracey93
Copy link
Collaborator

Thanks for reporting @LouiseSimpson this is very likely not an issue with the ALZ Terraform module and sounds more like a platform/policy engine issue.

Would you be able to open a Azure Support ticket (aka.ms/azuresupport) and share the ID with us here so we can track it's progress internally?

We need the support teams to investigate why this isn't working properly. Sounds like RBAC isnt inheriting in the hierarchy fast enough possibly if you are changing nothing but it works after a while when you move the subscription in and out of the same Management Group

@jtracey93 jtracey93 added bug Something isn't working external bug Needs: Author Feedback and removed Needs: Triage 🔍 Needs triaging by the team labels Mar 2, 2023
@matt-FFFFFF
Copy link
Member

Related to #438

@ghost
Copy link

ghost commented Mar 10, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

@LouiseSimpson
Copy link
Author

Azure Support ticket raised.
Support request ID : 2303130050002378

@ghost ghost added Needs: Attention 👋 Needs attention from the maintainers and removed Needs: Author Feedback Status: No Recent Activity labels Mar 13, 2023
@LouiseSimpson
Copy link
Author

Upgraded to terraform-azurerm-caf-enterprise-scale v3.3.0
Can not recreate this issue with the latest CAF version, so far.
Will keep an eye on it to see if this is still an issue.

@matt-FFFFFF
Copy link
Member

Thanks @LouiseSimpson tagging for auto closure

@ghost ghost removed the Needs: Attention 👋 Needs attention from the maintainers label Mar 16, 2023
@matt-FFFFFF matt-FFFFFF added Needs: Attention 👋 Needs attention from the maintainers Needs: Author Feedback and removed Needs: Attention 👋 Needs attention from the maintainers labels Mar 16, 2023
@ghost
Copy link

ghost commented Mar 23, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 7 days. It will be closed if no further activity occurs within 7 days of this comment.

@ghost ghost closed this as completed Mar 31, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Apr 30, 2023
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants