question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Insufficient privileges to complete the operation while trying to get AD groups

See original GitHub issue

Hi, I am trying to write a very simple script to list Azure AD groups.

  • Package Name: azure-common
  • Package Version: 1.1.28
  • Package Name: azure-graphrbac
  • Package Version: 0.61.1
  • Python Version: 3.10

Here is the script:

  from azure.common.credentials import ServicePrincipalCredentials
  from azure.graphrbac import GraphRbacManagementClient

   credentials = ServicePrincipalCredentials(
       client_id=client_id,
       secret=client_secret,
       resource="https://graph.windows.net",
       tenant=tenant_id
   )

   graphrbac_client = GraphRbacManagementClient(
       credentials,
       tenant_id
   )

   groups = graphrbac_client.groups.list()

   for g in groups:
       print(g.display_name)

The intention is to run it from “Azure automation” authenticating using a service-principle (not a user). The app registration I created on azure for authentication has Directory.Read.All and Group.Read.All permissions:

Screen Shot 2022-07-14 at 12 24 57 PM

But I still get: azure.graphrbac.models.graph_error_py3.GraphErrorException: Insufficient privileges to complete the operation.

What am I missing?

I see the same issue without solution: #16018

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
SaurabhSharma-MSFTcommented, Jul 14, 2022

@Racheli-Bloch We are looking into it and get back to you for any additional information.

0reactions
SaurabhSharma-MSFTcommented, Jul 21, 2022

@Racheli-Bloch We will now proceed to close this thread. If there are further questions regarding this matter, please reopen it and we will gladly continue the discussion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Insufficient privileges to complete the operation" while using ...
My goal is to get an access token from an App-Service as shown above and use it to create a user in azure...
Read more >
Graph API - Insufficient privileges to complete the operation
AD > App Registered > your app · Select Required Permission · Click Add and select Microsoft Graph and add it · select...
Read more >
Graph client: Insufficient privileges to complete the operation
Open the Azure Portal · Click Azure Active Directory · Click App registrations in the left bar · Click the app you registered...
Read more >
"Insufficient privileges to complete the operation" error Upon ...
Running the "SAM - Import User Subscriptions" job results in the following error in the syslog: Unhandled exception for profile ...
Read more >
Insufficient privileges to complete the operation while trying to ...
Hi! I am trying to write a very simple script to list Azure AD groups. Here is the script: from azure.common.credentials import ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found