Coder Social home page Coder Social logo

Policy Remediation - Log Analytics Contributor role not enough ? missing 'Microsoft.OperationalInsights/workspaces/sharedKeys/action' about azurepolicy HOT 4 CLOSED

jimgbritt avatar jimgbritt commented on August 23, 2024
Policy Remediation - Log Analytics Contributor role not enough ? missing 'Microsoft.OperationalInsights/workspaces/sharedKeys/action'

from azurepolicy.

Comments (4)

JimGBritt avatar JimGBritt commented on August 23, 2024 1

If a resource modified by deployIfNotExists or modify is outside the scope of the policy assignment or the template accesses properties on resources outside the scope of the policy assignment, the assignment's managed identity must be manually granted access or the remediation deployment will fail.

@cbezenco
I have been meaning to take a look and see if AssignPermissions would solve this. I have it already leveraged for Event Hubs as a sink point. Given the scope is an RG and the LA Workspace is in another RG, using AssignPermissions should give the MI rights during the assignment process. Happy to take a PR on this if you can test and let me know.

https://docs.microsoft.com/en-us/azure/governance/policy/concepts/definition-structure#:~:text=assignPermissions%3A%20%28Optional%29%20Set%20as%20true%20to%20have%20Azure,in%20all%20of%20the%20policies%20in%20the%20initiative%29. See below as an example.

$JSONPARMS = @'
{
            "profileName": {
                "type": "String",
                "metadata": {
                    "displayName": "Profile Name for Config",
                    "description": "The profile name Azure Diagnostics"
                }
            },
            "eventHubName": {
                "type": "String",
                "metadata": {
                    "displayName": "EventHub Name",
                    "description": "The event hub for Azure Diagnostics",
                    "strongType": "Microsoft.EventHub/Namespaces/EventHubs",
                    "assignPermissions": true
                }
            },

from azurepolicy.

cbezenco avatar cbezenco commented on August 23, 2024

It looks like I must have being doing something wrong when generating the original scripts or there might have been some delay as I got remediation working this morning (still not sure what I did wrong).

from azurepolicy.

cbezenco avatar cbezenco commented on August 23, 2024

I should have read the documentation

https://docs.microsoft.com/en-us/azure/governance/policy/how-to/remediate-resources
If a resource modified by deployIfNotExists or modify is outside the scope of the policy assignment or the template accesses properties on resources outside the scope of the policy assignment, the assignment's managed identity must be manually granted access or the remediation deployment will fail.

from azurepolicy.

KamilWiecek avatar KamilWiecek commented on August 23, 2024

@cbezenco you can use this script to fix msi role assignments on :
https://automate.guru/fix-msi-role-assignment/

from azurepolicy.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.