You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating eligible role assignment (Microsoft.Authorization/roleEligibilityScheduleRequests@2022-04-01-preview api version) with conditions, apply fails with 400 Bad Request - ERROR CODE: ScopeDoesNotMatchRoleDefinition.
When conditions are removed, eligible role assignment is created without issues.
Code snippet for creating role with conditions included:
resource "azapi_resource" "pim_assignments" {
type = "Microsoft.Authorization/roleEligibilityScheduleRequests@2022-04-01-preview"
name = random_uuid.pim_role_assignment_random_guid.id
parent_id = "/subscriptions/${data.azurerm_subscription.data_sub_corp.subscription_id}"
body = {
properties = {
requestType = "AdminAssign"
roleDefinitionId = data.azurerm_role_definition.data_sub_owner_corp.id
principalId = data.azuread_user.data_sub_owner_user.object_id
condition = "((!(ActionMatches{'Microsoft.Authorization/roleAssignments/write'})) OR (@Request[Microsoft.Authorization/roleAssignments:RoleDefinitionId] ForAnyOfAllValues:GuidNotEquals {8e3af657-a8ff-443c-a75c-2fe8c4bcb635}})) AND (( !(ActionMatches{'Microsoft.Authorization/roleAssignments/delete'})) OR (@Resource[Microsoft.Authorization/roleAssignments:RoleDefinitionId] ForAnyOfAllValues:GuidNotEquals {8e3af657-a8ff-443c-a75c-2fe8c4bcb635}}))"
conditionVersion = "2.0"
scheduleInfo = {
expiration = {
duration = "P365D"
type = "AfterDuration"
}
startDateTime = time_static.pim_role_assignment_creation_time.rfc3339
}
}
}
}
Error received:
Once conditions are removed, there is no scope error. If the assignable scope was incorrect, I would expect it to fail with or without conditions.
The text was updated successfully, but these errors were encountered:
When creating eligible role assignment (Microsoft.Authorization/roleEligibilityScheduleRequests@2022-04-01-preview api version) with conditions, apply fails with 400 Bad Request - ERROR CODE: ScopeDoesNotMatchRoleDefinition.
When conditions are removed, eligible role assignment is created without issues.
Code snippet for creating role with conditions included:
Error received:
![Image](https://private-user-images.githubusercontent.com/17924319/395060124-9f375886-0d58-414f-80f5-31364455bd34.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNDc4NzMsIm5iZiI6MTczOTM0NzU3MywicGF0aCI6Ii8xNzkyNDMxOS8zOTUwNjAxMjQtOWYzNzU4ODYtMGQ1OC00MTRmLTgwZjUtMzEzNjQ0NTViZDM0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDA4MDYxM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWZiYmI3YWMzODdhNmJmYjkwNGI1NGUxNTRhNGYyNmU0NWYxNjU4OWY5MWVhZjgwOGM0ZGY5ZjE2NmE3NmNiMmQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.1AAFQ1653sLFsd0PV9FKxs5AygNiHv1eD4Aw9n7ItoQ)
Once conditions are removed, there is no scope error. If the assignable scope was incorrect, I would expect it to fail with or without conditions.
The text was updated successfully, but these errors were encountered: