title: How to set correct privileges to use Python Azure SDK for Graph?
body: <p>I am trying to add a reply_url programmatically to an Azure app registration, but I receive an <code>GraphErrorException: Insufficient privileges to complete the operation</code>.</p>
  
  <p>Problem is I don't understand which privileges my app registration needs.</p>
  
  <p>Basically I am using the credentials of the app registration to change its own reply_urls.</p>
  
  <p>The privileges set are <code>User.Read</code> and <code>Application.ReadWrite.OwnedBy</code>. Both granted.</p>
  
  <p>Which one am I missing? And how can I find out?</p>
  
  <p>This is the SDK I am using: <a href="https://docs.microsoft.com/en-us/python/api/azure-graphrbac/?view=azure-python" rel="nofollow noreferrer">azure-graphrbac==0.61.1</a></p>
  
  <p>My code looks like this:</p>
  
  <pre><code>class GraphClient:
      def __init__(self, client_id, client_secret, tenant_id, object_id):
          self._credentials = ServicePrincipalCredentials(
              client_id=client_id,
              secret=client_secret,
              tenant=tenant_id,
              resource="https://graph.windows.net"
          )
          self._graph_client = GraphRbacManagementClient(
              credentials=self._credentials,
              tenant_id=tenant_id
          )
          self._application = self._graph_client.applications.get(object_id)
  
      def get_reply_urls(self) -&gt; List[str]:
          return self._application.reply_urls
  
      def add_reply_url(self, reply_url) -&gt; None:
          reply_urls: list = self.get_reply_urls()
          self._graph_client.applications.patch(
              self._application.app_id,
              ApplicationUpdateParameters(
                  reply_urls=[
                      *reply_urls,
                      reply_url]
              )
          )
  </code></pre>
  
  <p>EDIT: Added permissions screenshot
  <a href="https://i.stack.imgur.com/CdWLK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CdWLK.png" alt="enter image description here"></a></p>