title: Creating users using the Microsoft Graph API (PHP)
body: <h3>Issue</h3>
  <p>I'm trying to build an app to integrate with the <a href="https://docs.microsoft.com/en-us/graph/api/overview?view=graph-rest-1.0" rel="nofollow noreferrer">Microsoft Graph API</a>.</p>
  <p>I have an admin account in Azure, and have set up a new app through the portal.
  I've downloaded and installed the <a href="https://github.com/microsoftgraph/msgraph-sdk-php" rel="nofollow noreferrer">PHP SDK</a>, and have managed to set everything up so that I can get a user successfully.</p>
  <p>I can sign into the app and grant permissions to use my information (the permission I'm requesting is <code>Directory.ReadWrite.All</code>, but even just requesting <code>User.ReadWrite.All</code> is not working for me), however, my issue seems to be that I cannot access other users.</p>
  <p>The following only returns my own user:</p>
  <pre><code>$graph = new Graph();
  $graph-&gt;setAccessToken('/* SOMETOKEN */');
  $users = $graph-&gt;createRequest('GET', '/users')
      -&gt;setReturnType(User::class)
      -&gt;execute();
  </code></pre>
  <p>POSTing a new user returns me a 404 error:</p>
  <pre><code>$newUser = new User();
  $newUser-&gt;setAccountEnabled(true);
  $newUser-&gt;setGivenName('first_name');
  $newUser-&gt;setSurname('last_name');
  $newUser-&gt;setUserPrincipalName('some.email@address.com');
  
  $password = new PasswordProfile();
  $password-&gt;setPassword('some_password');
  $newUser-&gt;setPasswordProfile($password);
  
  $user = $graph-&gt;createRequest('POST', '/users')
      -&gt;attachBody($newUser)
      -&gt;execute();
  </code></pre>
  <p>Returns:</p>
  <pre><code>{
      &quot;error&quot;: {
          &quot;code&quot;: &quot;&quot;,
          &quot;message&quot;: &quot;No HTTP resource was found that matches the request URI 'https://outlook.office365.com:444/profile/v1.0/users('CID:a8ef4446a149de4d')/profile?api-version=AGSV1-internal'.&quot;,
          &quot;innerError&quot;: {
              &quot;date&quot;: &quot;/* timestamp */&quot;,
              &quot;request-id&quot;: &quot;/* an id */&quot;,
              &quot;client-request-id&quot;: &quot;/* an id */&quot;
          }
      }
  }
  </code></pre>
  <p>Even trying to use Microsoft's <a href="https://developer.microsoft.com/en-us/graph/graph-explorer" rel="nofollow noreferrer">Graph Explorer</a> is getting these same errors.</p>
  <p>Am I right in thinking this could be an account setup issue?</p>
  <h3>Update</h3>
  <p>Here is the error message the Graph Explorer is returning</p>
  <pre><code>{
      &quot;error&quot;: {
          &quot;code&quot;: &quot;&quot;,
          &quot;message&quot;: &quot;No HTTP resource was found that matches the request URI 'https://outlook.office365.com:444/profile/v1.0/users('CID:a8ef4446a149de4d')/profile?api-version=AGSV1-internal'.&quot;,
          &quot;innerError&quot;: {
              &quot;date&quot;: &quot;2020-11-30T16:51:41&quot;,
              &quot;request-id&quot;: &quot;743030b4-8835-4a9f-9e3e-d35919a1c289&quot;,
              &quot;client-request-id&quot;: &quot;c40cd440-d873-ba38-dce7-8669bc561e64&quot;
          }
      }
  }
  </code></pre>