Hi obsajenns,
Please use the Web App's Client Id and Secret instead of Native App in Partner Center:
Then it's available to execute Customers.Get():
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
So I am using the Peek CSP Billing example to do custom billing for our CSP clients. I had this working using app+user authentication, but since, I have had to update the dll's which caused the solution to no longer work. As we are not yet ready to do secure model, I wanted to switch to app authentication. It is failing on partnerOperations.Customers.Get() call.
Here are my excerpts:
AuthenticationHelper.cs
public IAggregatePartner GetCAPartnerCenterTokenUsingAppCredentials()
{
IPartnerCredentials partnerCredentials =
PartnerCredentials.Instance.GenerateByApplicationCredentials(
this.Configuration.ApplicationAuthentication.CAApplicationId,
this.Configuration.ApplicationAuthentication.CAApplicationSecret,
this.Configuration.ApplicationAuthentication.CAApplicationDomain);
// Create operations instance with partnerCredentials.
return PartnerService.Instance.CreatePartnerOperations(partnerCredentials);
}
Then in my CspUsageController.cs I have:
var partnerOperations = this.authHelper.GetCAPartnerCenterTokenUsingAppCredentials();
SeekBasedResourceCollection<Customer> customersPage = partnerOperations.Customers.Get();
I have registered my Native App in the Partner Center. This also is shown in the AAD app registrations which I have given the app API permissions to Access the Partner Center.
I have confirmed that Customers.Get() is supported by app authentication. Why am I still getting 'Unauthorized access' ?
I know this is not a user, but where can I assign App Registration permission to the Partner Center API?
Hi obsajenns,
Please use the Web App's Client Id and Secret instead of Native App in Partner Center:
Then it's available to execute Customers.Get():