question

VikasTiwari-2263 avatar image
0 Votes"
VikasTiwari-2263 asked PrashanthMyskar-7535 published

B2C Extension property creation error using graph api

Hi,

I was trying to create extension property through graph API, explained here.

I am using app id from (b2c-extensions-app. Do not modify. Used by AADB2C for storing user data.).

While running I am getting error :
"code": "Request_ResourceNotFound",
"message": "Resource 'SOME_GUID' does not exist or one of its queried reference-property objects are not present."

I am not sure what else I am missing here.

Thanks for you help.

azure-ad-b2cazure-ad-graph
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

amanpreetsingh-msft avatar image
0 Votes"
amanpreetsingh-msft answered PrashanthMyskar-7535 published

Hello @VikasTiwari-2263

Based on the error message, it appears to be a problem with the object ID of the b2c-extensions-app. Make sure you have used object ID of the b2c-extensions-app and not the app ID (aka client ID) in your post call. If you are still facing any issues, please follow below steps as I have tested and confirmed that these steps successfully update the schema.

  1. Navigate to Azure Portal > Azure Active Directory > App Registration.

  2. Locate the b2c-extensions-app and copy the Object ID of the b2c-extensions-app.

  3. Open Graph Explorer by using https://developer.microsoft.com/en-us/graph/graph-explorer# url.

  4. Click on Sign in with Microsoft on the left and Sign in with Global Admin account who is a member of same directory and not added as external (guest) user.

  5. Click on Modify permissions > select Directory.AccessAsUser.All > click Modify Permissions.

  6. Click on Accept at consent page.

  7. In Graph Explorer, use following query. Where the < Tenant Name > is your_tenant.onmicrosoft.com in your case and < ObjectID of the application > is the value copied in Step 2.
    POST //graph.microsoft.com/beta/users/your_globaladmin@your_tenant.onmicrosoft.com
    And use following Request Body:
    {
    "extension_e175b1fc21b144019cadxxxxxxxxxxxx_employeeType":"Value_to_be_assigned"
    }

  8. To verify if the attribute is updated successfully run following query:
    GET https://graph.microsoft.com/beta/users/ < User’s UPN or Object ID >


Please "Accept the answer" if the information provided helped you. This will help us and others in the community as well.

· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for your response, I have used client id instead of object id once I have changed it correctly that error has gone, but now I am getting "request to the endpoint timed out" while creating extension attribute, end part of stack trace in exception as follows:


--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.Auth.ClientCredentialProvider.<AuthenticateRequestAsync>d__9.MoveNext()

Sorry but I can try using graph explorer due to my org limitation on consent approve.

Thanks,
Vikas

0 Votes 0 ·

@VikasTiwari-2263 Thanks for the update.

Request to the endpoint timed out usually occurs due to network issue. Make sure the endpoint is not being blocked at any proxy or firewall device. You may consider using Postman tool where you can specify Proxy address. This option is helpful when you have a proxy device which allows unrestricted internet access.


Please "Accept the answer" if the information provided helped you. This will help us and others in the community as well.

1 Vote 1 ·

Please Ignore my above reply, my requests were getting time out due to outage in my company. Once its fixed I was able to create extension property.

I have one more doubt, I am unable to see the extension property I created in portal under "User Attributes" in my B2C tenant. Though I have verified extension property through get request but unable to see on portal.

Does portal not display custom attribute created through Graph API?

Thanks for your help on this.

0 Votes 0 ·

@VikasTiwari-2263 This is expected because of the way information is stored. Attributes created for Azure AD using above method are not visible under User Attributes in B2C blade.

1 Vote 1 ·

Hi,
I dont see the b2c-extensions-app application under Azure AD B2C. Do I need to create the application or it should already exist by default in the Azure AD B2C?
Thanks,
PM

0 Votes 0 ·