Hi Christopher,
The managed identity of a deployIfNotExists or modify policy assignment needs enough permissions to create or update targeted resources. Without the required permissions, the policy remediation task will fail.
Every DINE and modify effect policy will have its own system managed identity created, and the roles needed for the identities will vary depending upon what action policy does.
To verify what role definition is needed, you can check the roledefinitionsIDs section of the policy json of the built-in policy definitions.
"details": {
...
"roleDefinitionIds": [
"/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/roleDefinitions/{roleGUID}",
"/providers/Microsoft.Authorization/roleDefinitions/{builtinroleGUID}"
]
```}For custom policy with DINE or modify effect, you need to add the roledefinitionsIDs based on minimum role that would be needed to perform the action that policy is going to do while remediating the resources.
You can check more about the roles/permissions needed for any action here: [https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles](https://learn.microsoft.com/en-us/azure/role-based-access-control/built-in-roles) and based on that action matching with the policy remediation operations, you can either use built-in role or create custom role for roledefinitionIDs that are used in the policy for managed identity.