开发者

List custom created directory roles programmatically

I created some custom directory roles with specific permissions. I have to list these custom roles in a programmatic way.

This gives list of all directory roles in Graph

https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions

Attempted changing query with filter but throwing Bad Request

https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=isBuiltIn eq 'false'

{ "error": { "code": "Bad开发者_如何学JAVARequest", "message": "Invalid filter clause", "innerError": { "date": "2022-12-07T04:25:04", "request-id": "09f4f286-8088-4a17-881b-584377fe8c58", "client-request-id": "638047c0-e1e5-40e0-b166-416aacd1cc6a" } } }


I tried to reproduce the same in my environment and got below results:

In Azure Portal, I applied filter with Type: Custom and got custom directory roles as below:

List custom created directory roles programmatically

To get this list from Graph API, I ran the same query as you and got same error as below:

GET https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=isBuiltIn eq 'false'

Response:

List custom created directory roles programmatically

To resolve the error, I modified the query and got the results successfully like below:

GET https://graph.microsoft.com/v1.0/roleManagement/directory/roleDefinitions?$filter=(isBuiltIn eq false)&$select=displayName,id,isBuiltIn

Response:

List custom created directory roles programmatically

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜