GET https://management.azure.com/{roleId}?disambiguation_dummy&api-version=2022-04-01
URI Parameters
Name
In
Required
Type
Description
roleId
path
True
string
The fully qualified role definition ID. Use the format, /subscriptions/{guid}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for subscription level role definitions, or /providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId} for tenant level role definitions.
GET https://management.azure.com/roleDefinitionId?disambiguation_dummy&api-version=2022-04-01
import com.azure.core.util.Context;
/** Samples for RoleDefinitions GetById. */
public final class Main {
/*
* x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionById.json
*/
/**
* Sample code: Get role definition by ID.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void getRoleDefinitionByID(com.azure.resourcemanager.AzureResourceManager azure) {
azure
.accessManagement()
.roleAssignments()
.manager()
.roleServiceClient()
.getRoleDefinitions()
.getByIdWithResponse("roleDefinitionId", Context.NONE);
}
}
from azure.identity import DefaultAzureCredential
from azure.mgmt.authorization import AuthorizationManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-authorization
# USAGE
python get_role_definition_by_id.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = AuthorizationManagementClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.role_definitions.get_by_id(
role_id="roleDefinitionId",
)
print(response)
# x-ms-original-file: specification/authorization/resource-manager/Microsoft.Authorization/stable/2022-04-01/examples/GetRoleDefinitionById.json
if __name__ == "__main__":
main()