Partner-Center-DotNet-Samples icon indicating copy to clipboard operation
Partner-Center-DotNet-Samples copied to clipboard

Acquire customer byId throws exception if Azure AD Graph (deprecated) permissions are removed

Open dominicusmento opened this issue 2 years ago • 0 comments

Steps to reproduce

Use appOnly context by using the PartnerCenter WebApp application registration Backup Application Registration manifest.json from Azure Portal because that's the easiest way to return removed permissions Replace Azure Active Directory Graph (as its deprecated long time ago) permissions for the application registration in Azure Portal with the equivalent Microsoft Graph permissions (to be specific it is about Directory.Read.All) After obtaining appOnly context in your c# code - call

Customer customer = await aggregatePartner.Customers.ById(tenantId).GetAsync();

Expected behavior

The SDK should return the details about the customer and fill the variable with the correct model data

Actual behavior

The PartnerException from sdk is invoked due to 403 response from the server. I assume that SDK is accessing some old endpoint/action because the same permissions are enough (Microsoft Graph - Directory.Read.All) if we are using REST api call equivalent with postman.

Diagnostic logs

Microsoft.Store.PartnerCenter.Exceptions.PartnerException HResult=0x80131500 Message=The server returned error code '403' (Forbidden). Source=Microsoft.Store.PartnerCenter StackTrace: at Microsoft.Store.PartnerCenter.Network.PartnerServiceProxy'2.<HandleResponseAsync>d__70.MoveNext() at Microsoft.Store.PartnerCenter.Network.PartnerServiceProxy'2.<SendAsync>d__68.MoveNext() at Microsoft.Store.PartnerCenter.Network.PartnerServiceProxy'2.<GetAsync>d__58.MoveNext() at Microsoft.Store.PartnerCenter.Customers.CustomerOperations.<GetAsync>d__86.MoveNext() at ....

Environment

.NET 6 Both Azure Functions and Windows11 - local development All v3 versions of nuget, even the latest (3.4.0 at the moment)

dominicusmento avatar Aug 24 '23 11:08 dominicusmento