Bug or incomplete / outdated documentation for the B2B Microsoft Store Example

Author: StavrosDCreated Apr 11, 2024Updated Jan 19, 2026
Labelsbug

Which sample are you reporting a bug in?

Store Sample

Describe the bug There is either a bug or there is not enough information about the additional setup needed to run the B2B example. It is impossible to run the store sample without advanced azure skills.

To Reproduce

  1. Create an application on the Microsoft partner dashboard.
  2. Create some add-ons. 0$ price is fine.
  3. Create an App Registration on Azure Portal.
  4. Create a secret key on the App Registration.
  5. On the Microsoft Partner dashboard go to "Product collections and purchases". Enter the client ID from the App Registration.
  6. Download the Store Sample https://github.com/microsoft/Windows-universal-samples/tree/main/Samples/Store
  7. Open the example on Visual Studio
  8. On the B2B example code, enter the tenantId, clientId, clientSecret and appIdUri from the App Registration. https://github.com/microsoft/Windows-universal-samples/blob/bb470280e493a888d98ac367edf3b85f8c053c4f/Samples/Store/cs/Scenario7_B2B.xaml.cs#L35C25-L35C34
  9. Right click on the store sample project, associate it with your Microsoft store application and publish it.
  10. Download the application from the Microsoft Store.
  11. Run the example, purchase some add ons and then click on the Business to Business.
  12. Click on the "Get Customer Collections Id" button, the following error message is displayed: "GetCustomerCollectionsIdAsync failed."
  13. Click on the "Get Customer Purchase Id" button, the following error message is displayed: "GetCustomerPurchaseIdAsync failed."

Screenshots If applicable, add screenshots to help explain your problem.

Configuration

Additional context GetCustomerCollectionsIdAsync() or GetCustomerPurchaseIdAsync () should retrieve a Microsoft Store ID key that can be used to query for product entitlements or to consume product entitlements that are owned by the current user.

When I debug the application using Visual Studio, GetTokenFromAzureOAuthAsync() returns a JWT token, I do not get an authentication error. If I modify any of the tentantId, clientId, etc I get an error so I assume that the settings are OK so far.

I suspect that additional setup is needed on the Azure Portal.

  • Azure AD is now Entra ID. Is it possible that there are more settings required?
  • The App Registration Application ID URI in the Azure Portal starts with "api://" but in the example code it is "https://contoso.onmicrosoft.com".
  • Are there any requirements for specific API permissions ?
  • Should I add Optional claims in the Token configuration?
  • Should I add a scope, a role or something else?
  • Is some kind of authentication required?

Source: microsoft/Windows-universal-samples