Hello @Jomon Varghese
Can you try this JSON
This policy definition uses an IF statement to check whether the value of the "allowPermanentEligibleAssignment" parameter is set to "Yes". If it is, the policy will modify the role assignment to enable "Allow permanent eligible assignment" for the Contributor role in the specified resource group.
To apply this policy definition at the resource group level for the Contributor role, you can assign the policy to the resource group with the desired value for the "allowPermanentEligibleAssignment" parameter
{
"properties": {
"displayName": "Allow permanent eligible assignment",
"policyType": "BuiltIn",
"mode": "All",
"description": "This policy enables Allow permanent eligible assignment for the Contributor role in a resource group.",
"metadata": {
"category": "Access Control"
},
"parameters": {},
"policyRule": {
"if": {
"allOf": [
{
"field": "type",
"equals": "Microsoft.Authorization/roleAssignments"
},
{
"field": "Microsoft.Authorization/roleAssignments/memberType",
"equals": "User"
},
{
"field": "Microsoft.Authorization/roleAssignments/roleDefinitionId",
"equals": "[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'b24988ac-6180-42a0-ab88-20f7382dd24c')]"
}
]
},
"then": {
"effect": "modify",
"details": {
"roleDefinitionIds": [
"[concat('/subscriptions/', subscription().subscriptionId, '/providers/Microsoft.Authorization/roleDefinitions/', 'b24988ac-6180-42a0-ab88-20f7382dd24c')]"
],
"modifiableOnlyByAssignedIdentity": false,
"assignableScopes": [
"[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', resourceGroup().name)]"
],
"condition": {
"allOf": [
{
"field": "Microsoft.Authorization/roleAssignments/elidable",
"equals": true
},
{
"field": "Microsoft.Authorization/roleAssignments/condition",
"equals": "[if(equals(parameters('allowPermanentEligibleAssignment'), 'Yes'), 'true', 'false')]"
}
]
}
}
}
}
}
}
Kindly mark the answer as Accepted if it helped you !
Thanks !