Partner-Center-PowerShell: New-PartnerAccessToken : Parameter set cannot be resolved using the specified named parameters.

Steps to reproduce

   $AccessToken = New-PartnerAccessToken -Credential $Credentials -Resource $Resource -TenantId $TenantId -RefreshToken $SPNRefreshToken

Expected behavior

Should return AccessToken

Actual behavior

New-PartnerAccessToken : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:24
+ ... cessToken = New-PartnerAccessToken -Credential $Credentials -Resource ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-PartnerAccessToken], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Store.PartnerCenter.PowerShell.Commands.NewPartnerAccessToken
PS C:\Users\testuser> Get-Module PartnerCenter

ModuleType Version    Name                                ExportedCommands                                                                           
---------- -------    ----                                ----------------                                                                           
Script     2.0.1909.1 PartnerCenter                       {Add-PartnerCustomerCartLineItem, Add-PartnerCustomerUserRoleMember, Connect-PartnerCent...

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 30 (8 by maintainers)

Most upvoted comments

Exactly… but instead in typical fashion, everything is broken and documentation does not reflect the actual state of affairs… Please fix it guys…

@chwilfing one of the things that Connect-PartnerCenter does is attempt to configure a country property based on the reseller profile. If the command is not able to get the profile it will leave that value blank, which I believe is the root cause for your issue with the Get-PartnerOffers command. I will look into that, but if this is an issue for you please open a new issue so we can track everything.

Both of the problems mentioned in this issue have been resolved with version 2.0.1909.2. Let us know if you have any issues after updating.

me too - everything seems broken and the documentation seems to be just wrong.

is there currently any way to successfully authenticate?

Additionally - I use a RefreshToken from a KeyVault to get the accesstoken (which did work with PartnerCenter.NetCore 1.5.xx) but if i try to load any AZ Module AFTER the PartnerCenter module i get an

Import-Module : Assembly with same name is already loaded
At line:1 char:1
+ Import-Module az.accounts
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Import-Module], FileLoadException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand

The other way around, loading az module before partnercenter, loading the partnercenter module throws the error above.

current environment:

PS C:\Users\cw> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.2.2
PSEdition                      Core
GitCommitId                    6.2.2
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PartnerCenter Module 2.0.1909.1 Az Modules: 2.4.0

it would be really great if we could get a proper powershell support!

It is also interesting that the Get-PartnerAgreementDetail command does not return new customer agreement. It only returns old cloud agreement. I do not see any other cmdlet that can do that.

When this change was communicated we understood that only the parameters will change but the wokflow will not change. We should be able to just use our existing refresh tokens and just modify the commands parameters

On top of that if I try to generate access token by providing the user credentials in a browser I get:

New-PartnerAccessToken : AADSTS7000215: Invalid client secret is provided.

Is there something that works at all I wonder.

At least the old cmdlets work but unfortunately the reason why we need to move to the new version is the new customer agreement which we need to start onboarding our customers as it is process that takes time. I am seriously thinking of writing my own cmdlet for these things now.

And it is not the first transition as we had many breaking changes. Feels like we are in some constant preview. Now I am getting this error:

New-PartnerAccessToken : AADSTS700007: The grant was issued for a different client id.

Not sure how I reached to that state. It is generated even in a new powershell session. Also -Debug does not produce anything so why we have that at all.

I am getting the same experience. I really hoped this would be smoother experience to upgrade. Also it is not clear how do we generate new refresh tokens with this command. We need to generate new refresh token every day otherwise the refresh token expires after certain period and we do not want to run manual actions where we have to generate the refresh token by entering the user credentials in a browser.