How to retrieve role condition from ARM API

Neel Manthani 20 Reputation points
2026-06-17T17:46:29.8866667+00:00

I am using the Terraform azapi provider to pull ARM objects using the Azure API.

Specifically, I am trying to pull role definitions. Using this API version: Microsoft.Authorization/roleDefinitions@2022-04-01, I am able to get all information about a role definition EXCEPT for the condition. My question is how do I get the condition field? I can see the condition field when using resource graph explorer to view roles, but not in the retrieved ARM API objects.

Azure API Management
Azure API Management

An Azure service that provides a hybrid, multi-cloud management platform for APIs.

0 comments No comments

Answer accepted by question author
Jose Benjamin Solis Nolasco 12,601 Reputation points Volunteer Moderator
2026-06-17T20:36:21.3366667+00:00

Welcome to Microsoft Q&A

Hello @Neel Manthani I hope you are doing well,

The reason you are not seeing the condition field in the API response is due to the specific API version you are targeting.

While API version 2022-04-01 was the milestone release that brought Attribute-Based Access Control (ABAC) conditions to General Availability for Role Assignments, the schema for Role Definitions did not immediately expose the corresponding built-in condition properties.

According to the Azure REST API changelog, the condition and conditionVersion fields were not added to the Microsoft.Authorization/roleDefinitions schema until the 2022-05-01-preview API version. Resource Graph Explorer uses newer/internal API versions by default, which is why you can see the field there but not in your Terraform outputs.

How to resolve this: Update your azapi Terraform configuration to use the newer API version:

Change your type string to Microsoft.Authorization/roleDefinitions@2022-05-01-preview (or a newer available version).

Note that the condition field is not located at the root of properties. Because a role definition can have multiple permission sets, the condition is nested inside the permissions array.

Once you update the API version, you will find the condition field in the retrieved JSON object at this path: properties.permissions[0].condition

😊 If my answer helped you resolve your issue, please consider marking it as the correct answer. This helps others in the community find solutions more easily.

Was this answer helpful?

1 person found this answer helpful.

1 additional answer

Sort by: Newest
  1. Pravallika KV 18,850 Reputation points Microsoft External Staff Moderator
    2026-06-17T20:34:33.6733333+00:00

    Hi @Neel Manthani ,

    When you call the ARM API for role definitions (Microsoft.Authorization/roleDefinitions@2022-04-01), the payload represents the definition of permissions (for example, actions, dataActions, etc.).

    The RBAC condition (and related conditionVersion) is not a property of role definitions in ARM. It’s a property that exists only on role assignments (Microsoft.Authorization/roleAssignments), i.e., it’s evaluated as part of “who has which permissions, under what condition”.

    So, even though you may see condition when using Resource Graph Explorer (because it can aggregate/compute RBAC view data), the raw roleDefinitions ARM objects won’t include condition.

    If your goal is to retrieve the condition, you should query role assignments for the relevant scope(s) and filter for the role definition you care about. In other words:

    • Use Microsoft.Authorization/roleAssignments to list role assignments
    • Read the condition / conditionVersion fields from those role assignment objects return it. To access condition, you need to query roleAssignments instead.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.