title: Create user with Custom Attributes in Azure AD B2C with Graph API
body: <p>I am trying to create user with Graph API. user json object is as shown below.  I have created a custom attribute called <code>Role</code>. So while creating the user i need to give some value this <code>Role</code> as well.  But if i include this custom attribute i am getting error.</p>
  
  <blockquote>
    <p>One or More properties are invalid</p>
  </blockquote>
  
  <p>Create User is successful if i don't specify this custom attribute.</p>
  
  <pre><code> var jsonObject = new JObject
              {
                  {"accountEnabled", true},
                  {"country", "India"},
                  {"creationType", "LocalAccount"},
                  {"givenName","given"},
                  {"surName","surname"},
                  {"extension_Role","Admin"},
                  {"displayName","test12@xxx.com"},
                  {"passwordPolicies", "DisablePasswordExpiration,DisableStrongPassword"},
                  {"passwordProfile", new JObject
                  {
                      {"password", "Password@12"},
                      {"forceChangePasswordNextLogin", false}
                  } },
                  {"signInNames", new JArray
                      {
                          new JObject
                          {
                              {"value", "test12@xxx.com"},
                              {"type", "emailAddress"}
                          }
                      }
                  }
              };
  </code></pre>
  
  <p><code>extension_Role</code> is the property which is throwing error.  I tried giving <code>extension_appId_Role</code>. It gives a different error saying</p>
  
  <blockquote>
    <p>No extension properties exists with this name</p>
  </blockquote>
  
  <p>I guess we cannot add custom attributes while creating the user. Only we can update them using edit profile. Correct me if i am wrong. I have added this custom attribute to <code>sign-up</code> and <code>edit-profile</code> policies and as claims.</p>
  
  <p><strong>NOTE :</strong> I gave proper permissions to graph API and registered an app with App Registration portal.</p>
  
  <p><strong>Answer:</strong>  I found the answer . But not sure if that is the correct behaviour.  I could insert custom attributes when i append it with <code>b2c-extensions-app</code> app id. I registered a separate app under <code>App Registrations</code> but not sure why it's still taking <code>default b2c-extensions-app</code> application id. May be it's because  i created custom user attributes before registering app in <code>App Registrations</code>.</p>