microsoft / partner-center-powershell Goto Github PK
View Code? Open in Web Editor NEWPowerShell module for managing Partner Center resources.
Home Page: https://docs.microsoft.com/powershell/partnercenter/
License: MIT License
PowerShell module for managing Partner Center resources.
Home Page: https://docs.microsoft.com/powershell/partnercenter/
License: MIT License
Hi,
I'm trying to test the module but I have the following error:
you can not directly start a project with a class library result type
I'm using visual studio 2017. Thank you.
Is your feature request related to a problem? Please describe.
When attempting to run the command below, I receive the error, Object reference not set to an instance of an object.
New-PartnerAccessToken -ApplicationId <My App ID> -Resource https://api.partnercenter.microsoft.com -TenantId <My Tenant ID>
Describe the solution you would like
Instead of throwing this error, the interactive login prompt should be displayed asking me to enter my username and password, like it does when using ADAL directly as in the commands below.
$authenticationContext = New-Object Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext("https://login.windows.net/$Domain/")
$platformParameters = New-Object Microsoft.IdentityModel.Clients.ActiveDirectory.PlatformParameters -ArgumentList 'Auto'
$token = $authenticationContext.AcquireTokenAsync($ResourceUri, $ApplicationID, 'http://localhost', $platformParameters)
Connect-partnercenter with accesstoken
Everything fails for set-partnercustomersubscription, including the example at https://docs.microsoft.com/en-us/powershell/module/partnercenter/set-partnercustomersubscription?view=partnercenterps-1.5
->
Set-ParnterCustomerSubscription -AutoRenew $false -CustomerId xxx -Subscription xxx (ofcourse with valid custID and SubID.
We're mostly trying to get it to update the quantity of a specific subscription.
I've tried to run the command with the -inputobject $customer.customerId but to no avail.
Other set-x cmdlets do work, set-partnercustomer -custID xxx -email works just fine.
Update the Quantity of a specific subscription
Set-PartnerCustomerSubscription :
At line:1 char:1
+ CategoryInfo : NotSpecified: (:) [Set-PartnerCustomerSubscription], PartnerPSException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.PowerShell.Exceptions.PartnerPSException,Microsoft.Store.PartnerCenter.PowerShell.Commands.SetPartnerCustomer
Subscription
PartnerCenter Activity Log is coming up empty, no errors, the successful set commands do show up in the Activity log, and they're executed by the correct user.
Created a native app in AAD
Permissions for the app have been as described in https://docs.microsoft.com/en-us/powershell/partnercenter/secure-app-model?view=partnercenterps-1.5
Azure Active Directory Graph (3)
Directory.AccessAsUser.All
Delegated
Directory.Read.All
Delegated
User.Read
Delegated
Microsoft Graph (2)
Directory.Read.All
Application
SecurityEvents.Read.All
Application
Microsoft Partner Center (1)
user_impersonation
Delegated
Consent was performed with an account that is an admin agent in Partner Center.
Logon with the with the accesstoken, auth type is AppPlusUser
New-PartnerCustomer -BillingAddressLine1 '1 Microsoft Way' -BillingAddressCity 'Redmond' -BillingAddressCountry 'US' -BillingAddressPostalCode '98052' -BillingAddressState 'WA' -ContactEmail '[email protected]' -ContactFirstName 'Jane' -ContactLastName 'Doe' -Culture 'en-US' -Domain 'domaintestname.onmicrosoft.com' -Language 'en' -Name 'New CustomerTest'
New-PartnerCustomer : Bad Request
At line:1 char:1
+ New-PartnerCustomer -BillingAddressLine1 '1 Microsoft Way' -BillingAd ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-PartnerCustomer], PartnerException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.Exceptions.PartnerException,Microsoft.Store.PartnerCenter.PowerShell.Commands.NewPartnerCustomer
Get-Module -Name PartnerCenter
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 1.0.1808.2 PartnerCenter {Add-PartnerCustomerCartLineItem, Add-PartnerCustomerUserRoleMember, Connect-PartnerCenter, Get-PartnerAgreementDetail...}
I'm not sure what's causing the following error during the module import into Azure automation gallery
Error importing the module PartnerCenter. Import failed with the following error: Orchestrator.Shared.AsyncModuleImport.ModuleImportException: While importing the module, an error occurred while processing the module content. Internal error message: Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified..
My customers would like to have a clear image of the users on premises and the usage of licences in Office 365. If I have the ImmutableID
, I can connect that one with the ObjectGUID
on the AD User.
If I retrieve a user with Get-PartnerCustomerUser
I would like to find an attribute like ImmutableID
. This is possible with the Module MSOnline, but I haven't found the same option in PartnerCenter.
Set-PartnerCustomer should update the customer billing profile using the given input parameters if they are non-null and valid.
Set-PartnerCustomer doesn't seem to use the input parameters in updating the customer billing profile for many of the billing profile properties. Instead it is currently using Name
, which results in an invalid data error being produced.
For example, line 129 of src/PowerShell/Commands/SetPartnerCustomer.cs is currently:
customer.BillingProfile.DefaultAddress.AddressLine1 = UpdateValue(Name, customer.BillingProfile.DefaultAddress.AddressLine1);
When it probably should be:
customer.BillingProfile.DefaultAddress.AddressLine1 = UpdateValue(BillingAddressLine1, customer.BillingProfile.DefaultAddress.AddressLine1);
Same comment applies to lines 130-136.
Using PartnerCenter V1.0.1809.6 from the PowerShell Gallery
Remove-PartnerResellerRelationship -CustomerId $CustomerDetails.CustomerId -Confirm:$false
Remove-PartnerResellerRelationship : 3000 The relationship between the partner and customer does not exist
At line:1 char:1
+ Remove-PartnerResellerRelationship -CustomerId $CustomerDetails.Custo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Remove-PartnerResellerRelationship], PartnerPSException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.PowerShell.Exceptions.PartnerPSException,Microsoft.Store.PartnerCenter.PowerShell.Commands.RemovePartnerResellerRelationship
Relationship should be removed. That used to work in old module every time.
Error 3000.
Latest module
You cannot get the relationship as that is broken also as per #49
Get-PartnerCustomerRelationship -CustomerId $CustomerDetails.CustomerId
Get-PartnerCustomerRelationship : 1002 Authorization Failed
At line:1 char:1
+ Get-PartnerCustomerRelationship -CustomerId $CustomerDetails.Custome ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-PartnerCustomerRelationship], PartnerPSException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.PowerShell.Exceptions.PartnerPSException,Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerRelationship
However, the relationship can be seen here:
$CustomerDetails = Get-PartnerCustomer | Where-object {$_.Domain -like "*$TenantDomain*"}
$CustomerDetails | select *
AllowDelegatedAccess :
AssociatedPartnerId :
BillingProfile :
CommerceId :
CustomerId : xxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxx
Domain : xxxx.onmicrosoft.com
Name : xxx.onmicrosoft.com
RelationshipToPartner : Reseller
This prevents off-boarding of customers. Can it be looked at please?
Maybe related to #49?
Issue the command Get-Module -Name PartnerCenter
Using this version:
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 1.5.1902.3 PartnerCenter {Add-PartnerCustomerCartLineItem, Add-PartnerCustomerUserRoleMember, Connect-PartnerCenter, Disconnect-PartnerCenter...}
Expect to see a list of indirect resellers
Error message
Get-PartnerIndirectReseller : 1002 Authorization Failed
At line:1 char:1
+ Get-PartnerIndirectReseller
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-PartnerIndirectReseller], PartnerPSException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.PowerShell.Exceptions.PartnerPSException,Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerIndirectReseller
Windows 10
PowerShell 5.1
I'm having some issues with getting reliable return data, I understand that the data is stored in UTC time correct? now with that understanding I'd to pull data from then system and then match it too the reported data. Unfortunately the best I can do is to be off by about 2000-3400, I'd be happy with being only off by 500 or less.
report data 11/28/2018 - 12/27/2018
thanks Gerald
Unable to connect with Access Token with your documentation:
CMD: New-PartnerAccessToken -Credential $Credential -TenantId $TenantID -ServicePrincipal
Error: New-PartnerAccessToken : A parameter cannot be found that matches parameter name 'ServicePrincipal'.
When I call the cmdlet and let it prompt for customerID it fails telling me CustomerID doesn't pass RegEx pattern match:
PS C:\WINDOWS\system32> Get-PartnerCustomerAgreement
cmdlet Get-PartnerCustomerAgreement at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
CustomerId: $customer.customerID
Get-PartnerCustomerAgreement : Cannot validate argument on parameter 'CustomerId'. The argument "$customer.customerID" does not match the "^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$" pattern. Supply
an argument that matches "^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$" and try the command again.
At line:1 char:1
+ Get-PartnerCustomerAgreement
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-PartnerCustomerAgreement], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerAgreement
When I compare the customerID directly to the RegEx, I get a $true back:
PS C:\WINDOWS\system32> $customer.CustomerId -match "^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$"
True
When I pass the parameter in at call time, I get a generic exception error:
PS C:\WINDOWS\system32> Get-PartnerCustomerAgreement -CustomerId $customer.CustomerId
Get-PartnerCustomerAgreement : Exception of type 'Microsoft.Store.PartnerCenter.Exceptions.PartnerException' was thrown.
At line:1 char:1
+ Get-PartnerCustomerAgreement -CustomerId $customer.CustomerId
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-PartnerCustomerAgreement], PartnerException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.Exceptions.PartnerException,Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerAgreement
Installed today:
PS C:\WINDOWS\system32> Get-Module PartnerCenter | FL
Name : PartnerCenter
Path : C:\Program Files\WindowsPowerShell\Modules\PartnerCenter\1.0.1808.2\PartnerCenter.psd1
Description : Microsoft Partner Center - cmdlets for managing Partner Center resources.
ModuleType : Manifest
Version : 1.0.1808.2
NestedModules : {Microsoft.Store.PartnerCenter.PowerShell}
ExportedFunctions :
ExportedCmdlets : {Add-PartnerCustomerCartLineItem, Add-PartnerCustomerUserRoleMember, Connect-PartnerCenter, Get-PartnerAgreementDetail...}
ExportedVariables :
ExportedAliases :
Any help appreciated.
Is your feature request related to a problem? Please describe.
Log on in scripts is not possible in a tenant with MFA
Describe the solution you would like
With the depricated Add-PCAuthentication you could log on with a application id and client secret. Could that option be integrated in the new Connect-PartnerCenter?
We would like to retrieve a tenant ID based on customer domain name.
Like we could in old MSOnline Module (Get-MsolPartnerContract -DomainName FQDN.
This is needed as input for Get-PartnerCustomer -CustomerID to get a certain customer
Is your feature request related to a problem? Please describe.
I want to have more information about the usage than just the id.
In the api respond body in the example I see the resource URi as example. But I can't find any way to get this value per subscription per customer via the Powershell Module
Describe the solution you would like
I want the name of my resource because the get PartnerCustomerSubscriptonUsage only provides me the resource id and the category and subscategory , the name provided in my response is not the name of the actual VM/ Storage account. I think if i somehow got the resource URL( /subscripton/xx/rg/xxx/microsoft.compute/virtualmachine/name) value i could retrieve the name from there. But It seems that this is not possible with the powershell module. While in the documentation in the same powershell command page
https://docs.microsoft.com/en-us/partner-center/develop/get-a-customer-s-utilization-record-for-azure
you can see that the rest api response is more detailed.
Describe alternatives you have considered
I've considered calling the rest api through powershell but I think this would be an overkill as I already use this nice Powershell module
I'm trying to create a report for my customers usage and cost.
This can be all done with the command Get-PartnerCustomerSubscriptionUsage
Only the resourceuri (where i retract the resource name that is visible on the portal) can't be retrieved from this command.
The only command that can retrieve the name is
Get-PartnerCustomerSubscriptionUtilization -CustomerId $customerId -SubscriptionId $subscriptionId -StartDate $Start -EndDate $End -ShowDetails
But inside this command you've got the usage quantity and unit but no cost.
Is it possible to add also the resource uri to the first command " Get-PartnerCustomerSubscriptionUsage"
If i run both commands on the same subscription I sometimes get 0 query's for the Get-PartnerCustomerSubscriptionUtilization and a lot of data for the
Get-PartnerCustomerSubscriptionUsage. Which will give errors for my Report that one customer does not have ResourceUri in their report !!!
I need to automate the billing process for all tenants in our CSP, but every month I have to download reconfile, filter it and resend to each Service Manager to put the markup.
For that I'm trying to automate the process, but I can't download the information that gives me the reconfile for the IUR subscriptions, for the tenants I don't have the problem, because I can get the information with the "Get-PartnerCustomerServiceCosts" cmdlet, but for IUR i can't found any cmdlet that give me this information.
Can you say me if is possible download the entire reconfile or access to this information directly from any cmdlet in the scripting prespective?
Thank in advance
kind Regards
When running Connect-PartnerCenter on a vanilla installation of Powershell Core, the following error occurs:
Connect-PartnerCenter : Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621)
At line:1 char:1
+ Connect-PartnerCenter -AccessToken $pcToken.AccessToken -ApplicationI ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-PartnerCenter], FileLoadException
+ FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.Store.PartnerCenter.PowerShell.Commands.ConnectPartnerCenter
Should load the module and run the command
If the package is not installed, an error should state, that the module could not be loaded due to missing requirements.
Throws an error
Will be shared if needed
PS C:\> get-package Microsoft.IdentityModel.Clients.ActiveDirectory
get-package : No package found for 'Microsoft.IdentityModel.Clients.ActiveDirectory'.
At line:1 char:1
+ get-package Microsoft.IdentityModel.Clients.ActiveDirectory
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...lets.GetPackage:GetPackage) [Get-Package], Exception
+ FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackage
PS C:\> find-package Microsoft.IdentityModel.Clients.ActiveDirectory
Name Version Source Summary
---- ------- ------ -------
Microsoft.IdentityModel.Cli... 4.5.1 nuget.org This package contains the binaries of the Active Di...
PS C:\> $host
Name : ConsoleHost
Version : 6.2.0-preview.3
InstanceId : f7acc933-b8aa-4f45-bf06-058b5bfe783f
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Even after installing the package the error occours
Connect-PartnerCenter : Could not load file or assembly 'Microsoft.IdentityModel.Clients.ActiveDirectory, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621)
At line:1 char:1
+ Connect-PartnerCenter -AccessToken $pcToken.AccessToken -ApplicationI ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-PartnerCenter], FileLoadException
+ FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.Store.PartnerCenter.PowerShell.Commands.ConnectPartnerCenter
PS C:\Users\AxelBøgAndersen> Get-Package Microsoft.IdentityModel.Clients.ActiveDirectory
Name Version Source ProviderName
---- ------- ------ ------------
Microsoft.IdentityModel.Cli... 4.5.0 C:\Program Files\PackageManag... NuGet
the cmdlet returns this on all customerids:
Address :
CompanyName :
Domain :
Email :
TenantId :
Run - Get-PartnerAzureRateCard -Currency GBP -Region 'GB' - doesn't include the AzureOfferTerm object
To include the object described here - https://docs.microsoft.com/en-us/partner-center/develop/azure-rate-card#azureofferterm
Includes a truncated version of the AzureMeter object but not the AzureOfferTerm :(
Available if there is a guide on how to extract these
Windows 10
Latest module version
$token = New-PartnerAccessToken -Consent -Credential $credential -Resource https://api.partnercenter.microsoft.com -ServicePrincipal
$refreshToken = $token.RefreshToken
$pcToken = New-PartnerAccessToken -RefreshToken $refreshToken -Resource https://api.partnercenter.microsoft.com -Credential $credential
Connect-PartnerCenter -AccessToken $pcToken.AccessToken -ApplicationId $ClientAppId -TenantId $TenantID
Connect-PartnerCenter : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Connect-PartnerCenter -AccessToken $pcToken.AccessToken -ApplicationI ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Connect-PartnerCenter], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.Store.PartnerCenter.PowerShell.Commands.ConnectPartnerCe
nter
Should connect to PartnerCenter
It throws an error (the -AccessToken parameter is not in the cmdlet)
Please supply commands to produce. Then I'd be glad to upload.
Name : ConsoleHost
Version : 5.1.17763.134
InstanceId : fff38cbd-abe3-452b-b06c-046b420db12e
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Tested in:
Name : ConsoleHost
Version : 6.2.0-preview.3
InstanceId : 445eab07-cb4b-41cd-a231-5d1f36b439bc
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
Same result.
I'd love to use this module but I can't because it doesn't support MFA enabled accounts.
$ Connect-PartnerCenter -Credential $myO365cred -ApplicationId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx Connect-PartnerCenter : AADSTSxxxxx: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'. Trace ID: e53ccd0c-6e3a-4497-96e2-b9f0f1f4f800 Correlation ID: b8853794-021a-421e-a5c4-70493690f85c Timestamp: 2018-08-30 15:34:14Z At line:1 char:1
+ CategoryInfo : NotSpecified: (:) [Connect-PartnerCenter], AdalServiceException
+ FullyQualifiedErrorId : Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException,Microsoft.Store.PartnerCenter.PowerShell.Commands.ConnectPa
rtnerCenter`
What steps can reproduce the defect?
Please share the setup, commandline for vstest.console, sample project, target
framework etc.
I am trying to execute the following commands to get token:
PS C:\WINDOWS\system32> $token = New-PartnerAccessToken -RefreshToken $refreshToken -Resource https://management.azure.com/ -Credential $credential -ServicePrincipal -TenantId $tenantId
New-PartnerAccessToken : A parameter cannot be found that matches parameter name 'ServicePrincipal'.
At line:1 char:125
+ ... nagement.azure.com/ -Credential $credential -ServicePrincipal -Tenant ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-PartnerAccessToken], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Store.PartnerCenter.PowerShell.Commands.NewPartnerAcces
sToken
PS C:\WINDOWS\system32> $graphToken = New-PartnerAccessToken -RefreshToken $refreshToken -Resource https://graph.microsoft.com -Credential $credential -ServicePrincipal -TenantId $tenantId
New-PartnerAccessToken : A parameter cannot be found that matches parameter name 'ServicePrincipal'.
At line:1 char:128
+ ... graph.microsoft.com -Credential $credential -ServicePrincipal -Tenant ...
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [New-PartnerAccessToken], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Store.PartnerCenter.PowerShell.Commands.NewPartnerAcces
sToken
but I get error:
Share the expected output
Getting token succesfully
What is the behavior observed?
error. Previous version of the module didn't had error with this command. You can also see document updated:
MicrosoftDocs/partner-center-docs-powershell@e06a4a8#diff-6782d3cba88be2eb244513cc067a0d37
When breaking changes are introduce the major version of the module should be increased. So this module should be 2.x.xxxx.x otherwise people will deploy minor versions without actually knowing that breaking changes are introduced. Please start updating the version of the module appropriately. Also start publishing migration guides just how Az/AzureRM does it.
Please share test platform diagnostics logs.
The logs may contain test assembly paths, kindly review and mask those before sharing.
provided
Please share additional details about your environment.
Version
PS C:\WINDOWS\system32> Get-Module -ListAvailable -Name PartnerCenter
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 1.5.1902.3 PartnerCenter {Add-PartnerCustomerCartLineItem, Add-PartnerCustomerUserR...
PS C:\WINDOWS\system32> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 17763 134
Get-Help Connect-PartnerCenter -Examples
NAME
Connect-PartnerCenter
SYNOPSIS
Connects to Partner Center with an authenticated account for use with cmdlet requests.
-------------------------- Example 1 --------------------------
PS C:\> Connect-PartnerCenter -ApplicationId '<AppId>'
Connect to Partner Center using the specified application identifier during authentication.
-------------------------- Example 2 --------------------------
PS C:\> $credential = Get-Credential
PS C:\> Connect-PartnerCenter -ApplicationId '<AppId>' -Credential $credential
Connect to Partner Center using the specified application identifier during authentication.
-------------------------- Example 3 --------------------------
PS C:\> $credential = Get-Credential
PS C:\> Connect-PartnerCenter -Credential $credential -ServicePrincipal -TenantId '<AppId>'
Connects to Partner Center using app only authentication. When prompted for credential specify the application
identifier for the username and the application secret for the password.
What steps can reproduce the defect?
Please share the setup, commandline for vstest.console, sample project, target
framework etc.
The -ServicePrincipal switch has been removed in version 1.5.1902.1:
Definition :
Connect-PartnerCenter -ApplicationId [-Environment ] [-TenantId
] []
Connect-PartnerCenter -AccessToken <string> -ApplicationId <string> [-Environment
<EnvironmentName>] [-TenantId <string>] [<CommonParameters>]
Connect-PartnerCenter -Credential <pscredential> -TenantId <string> [-ApplicationId <string>]
[-Environment <EnvironmentName>] [<CommonParameters>]
Share the expected output
What is the behavior observed?
Please share test platform diagnostics logs.
The logs may contain test assembly paths, kindly review and mask those before sharing.
Please share additional details about your environment.
Version
Add-PartnerCustomerUserRoleMember -CustomerId $CustomerId -UserId '$UserId -RoleId $RoleId
Add-PartnerCustomerUserRoleMember : 2000 Customer id is required.
At line:1 char:9
+ Add-PartnerCustomerUserRoleMember -CustomerId 'xxxxxxx-xxxxxxxx ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-PartnerCustomerUserRoleMember], PartnerPSException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.PowerShell.Exceptions.PartnerPSException,Microsoft.Store.PartnerCenter.PowerShell.Commands.AddPartnerCustomerUserRoleMember
It throws an error because CustomerId even it's ok.
Please share test platform diagnostics logs.
The logs may contain test assembly paths, kindly review and mask those before sharing.
Get-Module PartnerCenter | select Name,Version
Name Version
---- -------
PartnerCenter 1.5.1902.5
Current code block, after authentication and getting $agreement with Get-PartnerAgreementDetail:
foreach ($Line in $csv){
$tid = (Get-MsolPartnerContract -DomainName $line.email.split("@")[1]).tenantid.guid
New-PartnerCustomerAgreement -TemplateId $agreement.TemplateId -AgreementType MicrosoftCloudAgreement -CustomerId $tid -ContactEmail $line.email -ContactFirstName $line.fname -ContactLastName $line.lname
}
$csv is imported from a file containing 3 headers: email,fname,lname and returns proper values
When texted a few weeks ago, the same code succeeded with no errror
New-PartnerCustomerAgreement : 600002 Date of agreement cannot be greater than the current date.
At line:13 char:5
+ New-PartnerCustomerAgreement -TemplateId $agreement.TemplateId -A ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-PartnerCustomerAgreement], PartnerPSException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.PowerShell.Exceptions.PartnerPSException,Microsoft.Store.PartnerCenter.PowerShell.Commands.NewPartnerCustomerAgreement
PSVersion: 5.1.17763.1
winver: 1809 build 17763.55
Module Version : 1.5.1810.2
I'm getting errors with most of these cmdlets.
I've tried connecting multiple ways, e.g.:
$AppCred = Get-Credential -Message 'Username = AppID, Password = App Secret'
$token = New-PartnerAccessToken -Credential $AppCred -Consent -Resource https://api.partnercenter.microsoft.com -ServicePrincipal
# Entering Global Admin creds when prompted
Connect-PartnerCenter -AccessToken $Token.AccessToken -AccessTokenExpiresOn $Token.ExpiresOn -ApplicationId $appId -TenantId $TenantID
OR this way
$token2 = New-PartnerAccessToken -ApplicationId $appid -Resource https://api.partnercenter.microsoft.com -TenantId $TenantID -Consent
# Entering Global Admin creds when prompted
Connect-PartnerCenter -AccessToken $Token2.AccessToken -AccessTokenExpiresOn $Token2.ExpiresOn -ApplicationId $appId -TenantId $TenantID
^ Both methods are giving me the same results.
These cmdlets work
Get-PartnerCustomer
(Returns all customers as expected)
Get-PartnerCustomerUser -CustomerId $CustomerTenantID
(Returns all users for the customer)
Get-PartnerCustomerUserLicense -CustomerId $CustomerTenantID-UserId $UserID
(Returns the licenses for user in Customer Tenant)
These cmdlets do not work
PS>Get-PartnerCustomerLicenseDeploymentInfo -CustomerId $CustomerTenantID
Get-PartnerCustomerLicenseDeploymentInfo : {
"Message": "The supplied role does not have the rights to perform the requested operation."
}
At line:1 char:1
+ Get-PartnerCustomerLicenseDeploymentInfo -CustomerId $CustomerTenantID
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-PartnerCustomerLicenseDeploymentInfo], PartnerException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.Exceptions.PartnerException,Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerLicenseDeploymentInfo
PS>Get-PartnerCustomerBillingProfile -CustomerId $CustomerTenantID
Get-PartnerCustomerBillingProfile : The supplied role does not have the rights to perform the requested operation.
At line:1 char:1
+ Get-PartnerCustomerBillingProfile -CustomerId $CustomerTenantID
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-PartnerCustomerBillingProfile], PartnerException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.Exceptions.PartnerException,Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerBillingProfile
PS>Get-PartnerCustomerUsageSummary -CustomerId $CustomerTenantID
Get-PartnerCustomerUsageSummary : The supplied role does not have the rights to perform the requested operation.
At line:1 char:1
+ Get-PartnerCustomerUsageSummary -CustomerId $CustomerTenantID
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-PartnerCustomerUsageSummary], PartnerException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.Exceptions.PartnerException,Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerUsageSummary
I'm not sure what I'm doing wrong.
What steps can reproduce the defect?
Please share the setup, commandline for vstest.console, sample project, target
framework etc.
PS C:\Users\Stanislav> Import-Module PartnerCenter
Import-Module : Could not load file or assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
At line:1 char:1
+ Import-Module PartnerCenter
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], FileNotFoundException
+ FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand
Share the expected output
Successful import
What is the behavior observed?
error
Please share test platform diagnostics logs.
The logs may contain test assembly paths, kindly review and mask those before sharing.'
provided
Please share additional details about your environment.
Version
PS C:\Users\Stanislav> $PSVersionTable.PSVersion
Major Minor Patch PreReleaseLabel BuildLabel
----- ----- ----- --------------- ----------
6 1 1
PS C:\Users\Stanislav> Get-Module -ListAvailable | Select-Object Version, Name
Version Name
------- ----
1.2.1 Az.Accounts
1.0.1 Az.Aks
1.0.1 Az.AnalysisServices
1.0.0 Az.ApiManagement
1.0.0 Az.ApplicationInsights
1.1.0 Az.Automation
1.0.0 Az.Batch
1.0.0 Az.Billing
1.0.1 Az.Cdn
1.0.0 Az.CognitiveServices
1.2.0 Az.Compute
1.0.0 Az.ContainerInstance
1.0.1 Az.ContainerRegistry
1.0.1 Az.DataFactory
1.0.0 Az.DataLakeAnalytics
1.0.2 Az.DataLakeStore
1.0.0 Az.DevTestLabs
1.0.0 Az.Dns
1.1.0 Az.EventGrid
1.0.0 Az.EventHub
1.0.0 Az.HDInsight
1.0.2 Az.IotHub
1.0.1 Az.KeyVault
1.1.0 Az.LogicApp
1.0.0 Az.MachineLearning
1.0.0 Az.MarketplaceOrdering
1.0.0 Az.Media
1.0.0 Az.Monitor
1.1.0 Az.Network
1.0.0 Az.NotificationHubs
1.0.0 Az.OperationalInsights
1.0.0 Az.PolicyInsights
1.0.0 Az.PowerBIEmbedded
1.0.1 Az.RecoveryServices
1.0.0 Az.RedisCache
1.0.0 Az.Relay
1.1.1 Az.Resources
1.0.0 Az.ServiceBus
1.0.1 Az.ServiceFabric
1.0.2 Az.SignalR
1.1.0 Az.Sql
1.0.2 Az.Storage
1.0.0 Az.StreamAnalytics
1.0.1 Az.TrafficManager
1.1.0 Az.Websites
2.0.2.4 AzureAD
1.5.1902.3 PartnerCenter
1.0.0 WindowsCompatibility
6.1.0.0 CimCmdlets
1.2.2.0 Microsoft.PowerShell.Archive
6.1.0.0 Microsoft.PowerShell.Diagnostics
6.1.0.0 Microsoft.PowerShell.Host
6.1.0.0 Microsoft.PowerShell.Management
6.1.0.0 Microsoft.PowerShell.Security
6.1.0.0 Microsoft.PowerShell.Utility
6.1.0.0 Microsoft.WSMan.Management
1.1.7.2 PackageManagement
1.6.7 PowerShellGet
0.0 PSDesiredStateConfiguration
6.1.0.0 PSDiagnostics
2.0.0 PSReadLine
1.1.2 ThreadJob
2.0.1.0 Appx
1.0.0.0 AssignedAccess
1.0.0.0 BitLocker
1.0.0.0 BranchCache
1.0 Defender
1.0.0.0 DirectAccessClientComponents
1.0.0.0 DnsClient
1.0.0.0 EventTracingManagement
1.0.0.0 HgsDiagnostics
2.0.0.0 Hyper-V
1.1 Hyper-V
3.0.0.0 Microsoft.PowerShell.Diagnostics
1.0.0.0 Microsoft.PowerShell.LocalAccounts
3.1.0.0 Microsoft.PowerShell.Management
1.0 MMAgent
2.0.0.0 NetAdapter
1.0.0.0 NetConnection
1.0.0.0 NetEventPacketCapture
2.0.0.0 NetLbfo
1.0.0.0 NetNat
2.0.0.0 NetQos
2.0.0.0 NetSecurity
1.0.0.0 NetSwitchTeam
1.0.0.0 NetTCPIP
1.0.0.0 NetWNV
1.0.0.0 NetworkConnectivityStatus
1.0.0.0 NetworkSwitchManager
1.0.0.0 NetworkTransition
1.0.0.0 PcsvDevice
1.0.0.0 PnpDevice
1.0.0.0 ScheduledTasks
2.0.0.0 SecureBoot
2.0.0.0 SmbShare
2.0.0.0 SmbWitness
1.0.0.0 StartLayout
2.0.0.0 Storage
2.0.0.0 TrustedPlatformModule
2.0.0.0 VpnClient
1.0.0.0 Wdac
1.0.0.0 WindowsDeveloperLicense
1.0 WindowsErrorReporting
1.0.0.0 WindowsUpdate
1.0.0.2 WindowsUpdateProvider
Connect-PartnerCenter -ApplicationId <GUID> -Credential $credential
$usage = Get-PartnerCustomerSubscriptionUtilization -CustomerId <GUID> -SubscriptionId <GUID> -StartDate <Date> -EndDate <Date> -Granularity Daily -ShowDetails
Data from same subscriptions is retrieved properly with PartnerCenterModule 0.10.0.5
Error is returned by PartnerCenter 1.5.1810.2 for two subscriptions out of 16. Data for other 14 subscriptions is correct.
System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Store.PartnerCenter.PowerShell.Common.ResourceExtensions.CopyFrom(PSAzureUtilizationRecord azureUtilizationRecord, AzureUtilizationRecord other) in D:\a\1\s\src\PowerShell\Common\ResourceExtensions.cs:line 56 at Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerSubscriptionUtilization.<>c.<ExecuteCmdlet>b__24_0(AzureUtilizationRecord r) in D:\a\1\s\src\PowerShell\Commands\GetPartnerCustomerSubscriptionUtilization.cs:line 94 at System.Linq.Enumerable.WhereSelectListIterator``2.MoveNext() at System.Collections.Generic.List``1.InsertRange(Int32 index, IEnumerable``1 collection) at Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerSubscriptionUtilization.ExecuteCmdlet() in D:\a\1\s\src\PowerShell\Commands\GetPartnerCustomerSubscriptionUtilization.cs:line 94 at Microsoft.Store.PartnerCenter.PowerShell.Commands.PartnerPSCmdlet.ProcessRecord() in D:\a\1\s\src\PowerShell\Commands\PartnerPSCmdlet.cs:line 61 at System.Management.Automation.CommandProcessor.ProcessRecord()
Windows 10 Version 1803
PowerShell 5.1.17134.228
PartnerCenter 1.5.1810.2
Hello,
Compare to the old module, the Get-PartnerInvoiceLineItem -InvoiceId xxxx-BillingProvider Azure -LineItemType UsageLineItems missed a lot of value.
example : SKU / includedQuantity / ListPrice / taxamout / postTaxTotal / chargetype / etc...
so with this command it's impossible to retrieve the azure part of the billing.
When I run my script in PowerShell with this command in it, Get-PartnerCustomerSubscriptionUtilization, I receive a summary total of 64,151.69 and when I run the exact same code as an Azure Automation job I receive a summary total of 61,940.90.
Why would this be?
Module information
Azure Module - PartnerCenter - 1.5.1812.1
Azure PowerShell - PartnerCenter - 1.5.1812.1
TIA
Gerald
Connect-partnercenter with login dialog returns AADSTS50011: The reply url specified in the request does not match the reply urls configured for the application from Azure AD when http://localhost/ is the reply url
Just execute statement e.g.
PS C:\> Get-PartnerCustomerUsageSummary -CustomerId $customer.CustomerId
Module Version:
PS C:\> Get-InstalledModule -Name PartnerCenter | FT -AutoSize
Version Name Repository Description
------- ---- ---------- -----------
1.0.1809.10 PartnerCenter PSGallery Microsoft Partner Center - cmdlets for managing Partner Center resources.
should return Customer Usage Summary
PS C:\> Get-PartnerCustomerUsageSummary -CustomerId $customer.CustomerId
Get-PartnerCustomerUsageSummary : Object of type 'Microsoft.Store.PartnerCenter.Models.Usage.SpendingBudget' cannot be converted to type
'Microsoft.Store.PartnerCenter.PowerShell.Models.Usage.PSSpendingBudget'.
At line:1 char:1
+ Get-PartnerCustomerUsageSummary -CustomerId $customer.CustomerId
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-PartnerCustomerUsageSummary], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerUsageSummary
Windows 10 Enterprise 1709
PowerShell 5.1 Build 16299 Revision 611
When placing a new order for an Addon to an existing subscription, the following error is thrown
"New-PartnerCustomerOrder : 2000 ParentSubscriptionId is not supported for this request."
New-PartnerCustomerOrder -CustomerId -LineItems $lineItems
$LineItems content:
FriendlyName : Office 365 Advanced Threat Protection
LineItemNumber : 0
OfferId : a2706f86-868d-4048-989b-0c69e5c76b63
PartnerIdOnRecord :
ParentSubscriptionId : <SubscriptionId of the Parent Exchange Online Plan 1 subscription>
ProvisioningContext : {}
Quantity : 31
SubscriptionId :
I expect that the order will be placed however, I'm unsure what content the LineItem fields are expecting to purchase a new addon. This may be a result of not providing the correct data in the PSOrderLineItem object. Having an example in the help for New-PartnerCustomerOrder where an Addon is being purchased for a parent subscription would be beneficial.
Error thrown
"New-PartnerCustomerOrder : 2000 ParentSubscriptionId is not supported for this request."
PartnerCenter v1.5.1812.1
PSVersion v5.0.10586.117
What steps can reproduce the defect?
Please share the setup, commandline for vstest.console, sample project, target
framework etc.
The command below was working several weeks ago:
New-PartnerCustomerAgreement -TemplateId 998b88de-aa99-4388-a42c-1b3517d49490 -AgreementType MicrosoftCloudAgreement -ContactEmail "" -ContactFirstName "" -ContactLastName "" -ContactPhoneNumber "" -CustomerId "" -DateAgreed ([datetime]::ParseExact("2018-11-01","yyyy-MM-dd",$null))
When I executed it on the latest version of the module just today I got error:
New-PartnerCustomerAgreement : The given key was not present in the dictionary.
At line:1 char:1
+ New-PartnerCustomerAgreement -TemplateId 998b88de-aa99-4388-a42c-1b35 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-PartnerCustomerAgreement], KeyNotFoundException
+ FullyQualifiedErrorId : System.Collections.Generic.KeyNotFoundException,Microsoft.Store.PartnerCenter.PowerShell
.Commands.NewPartnerCustomerAgreement
Expected output was to complete successfully
Behavior was error
Verbose or Debug does not produce any additional information. Seems those were never implemented.
After some testing it is working if you provide valid value for UserId. In documentation UserId is not required parameter and it was working without this parameter several weeks ago as I've tested. Breaking changes should be documented and version should be increased properly when there are such.
PartnerCenter 1.5.1812.1
PS C:\WINDOWS\system32> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 17763 134
when I connect to the PartnerCenter using the following connection;
$appSecret = $AppKey | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential ($AppId, $appSecret)
$oConnectionObject = Connect-PartnerCenter -Credential $credential -ServicePrincipal -TenantId $AuthTenantID
Then trying to use Get-PartnerCustomerUsageSummary to work and then I receive the following message..
PS Azure_Source> $CustomerBillingSummary = Get-PartnerCustomerUsageSummary -CustomerId $CustomerId
Get-PartnerCustomerUsageSummary : This resource can't be accessed by application credentials.
At line:1 char:27
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We used to be able to query registered emial fro Get-PCCustomer and via
Get-PCCustomerCompanyProfile -TenantId $($CustomerDetails.id) cmdlets.
New commands do not have equivalent of the latter and the Get-PartnerCustomer does not contain that information. It is extremely important we get that email address as we use it for on-boarding throughout the code,
Get-PCCustomerCompanyProfile -TenantId $($CustomerDetails.id)
tenantId : x-x-x-x-xxxxxx
domain : xxxxxonmicrosoft.com
companyName : Default Directory
address : @{country=GB}
email : xxxx@gmail.com
links : @{self=}
attributes : @{objectType=CustomerCompanyProfile}
Also:
$Customer = Get-PCCustomer -TenantId $($CustomerDetails.id)
$Customer.CompanyProfile.Email
x@gmail.com
And:
$Customer = Get-PCCustomer -TenantId $($CustomerDetails.id)
$Customer
id : x-x-x-x-xxxxx
commerceId : x-x-x-x-xxxxx
companyProfile : @{tenantId=x-x-x-x-x; domain=x.onmicrosoft.com; companyName=Default Directory; address=; email=x@gmail.com; links=; attributes=}
billingProfile : @{id=xxx-xxx-xxx-xxx-xxx ; firstName=xxx-xxx-xxx-974b-xxxx; lastName=xxx-xx-47d8-xx-xx; culture=en-US; language=en; companyName=Default Directory; defaultAddress=; links=; attributes=}
relationshipToPartner : reseller
allowDelegatedAccess : True
customDomains : {x.onmicrosoft.com}
links : @{self=}
attributes : @{objectType=Customer}
New commands however only show:
CustomerId Domain Name
---------- ------ ----
xx-xx-xx-xx-xxxx x.onmicrosoft.com Default Directory
I know that email is in the billing profile but it is exactly what I want to set as it does not get populated from CompanyProfile automatically when you create new sub. It needs to be added in manually and old code allowed me to do it as it was querying:
"https://api.partnercenter.microsoft.com/v1/customers/{0}/profiles/company"
Can email field be added please and can we have the new command to query it directly as well?
Not sure if we can just fix it by doing this:
/// <summary>
/// Addtional operations to be performed when cloning an instance of <see cref="Customer" /> to an instance of <see cref="PSCustomer" />.
/// </summary>
/// <param name="customer">The customer being cloned.</param>
private void CloneAdditionalOperations(Customer customer)
{
CustomerId = customer.Id;
Domain = customer?.CompanyProfile?.Domain;
Name = customer?.CompanyProfile?.CompanyName;
Email = customer?.CompanyProfile?.Email;
}
I'm working on converting our billing module from the previous PartnerCenter version, I'm not finding a command that will return the resourceURI string that get-PCUsage does.
tia for any help
PS C:\> $ClientSecret = Get-AzKeyVaultSecret -VaultName MyKeys -Name MySecret | Select-Object -ExpandProperty SecretValueText
PS C:\> $clientSecretSecure = $clientSecret | ConvertTo-SecureString -AsPlainText -Force
PS C:\> $TenantID = 'MyTenant.onmicrosoft.com'
PS C:\> $Credential = New-Object System.Management.Automation.PSCredential ($ClientAppId, $clientSecretSecure)
PS C:\> $refreshToken = Get-AzKeyVaultSecret -VaultName MyKeys -Name MyRefreshToken | Select-Object -ExpandProperty SecretValueText
PS C:\> $pcToken = New-PartnerAccessToken -RefreshToken $refreshToken -Resource https://api.partnercenter.microsoft.com -Credential $credential
New-PartnerAccessToken : The 'New-PartnerAccessToken' command was found in the module 'PartnerCenter.NetCore', but the module could not be loaded. For more information, run 'Import-Module PartnerCenter.NetCore'.
At line:1 char:12
+ $pcToken = New-PartnerAccessToken -RefreshToken $refreshToken -Resour ...
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-PartnerAccessToken:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
PS C:\>
PS C:\> $refreshtoken = 'My very long token'
PS C:\> $ClientAppId = 'My Client Id'
PS C:\> $ClientSecret = 'My Client Secret'
PS C:\> $clientSecretSecure = $clientSecret | ConvertTo-SecureString -AsPlainText -Force
PS C:\> $TenantID = 'MyTenant.onmicrosoft.com'
PS C:\> $Credential = New-Object System.Management.Automation.PSCredential ($ClientAppId, $clientSecretSecure)
PS C:\> $pcToken = New-PartnerAccessToken -RefreshToken $refreshToken -Resource https://api.partnercenter.microsoft.com -Credential $credential
PS C:\> Get-AzKeyVaultSecret -VaultName MyKeys -Name MySecret
Get-AzKeyVaultSecret : The Azure PowerShell session has not been properly initialized. Please import the module and try again.
At line:1 char:1
+ Get-AzKeyVaultSecret -VaultName MyKeys -Name MySecret
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-AzKeyVaultSecret], InvalidOperationException
+ FullyQualifiedErrorId : System.InvalidOperationException,Microsoft.Azure.Commands.KeyVault.GetAzureKeyVaultSecret
PS C:\>
In the first scenario a refresh token should be issued. The module should be imported automatically. Running Import-Module PartnerCenter.NetCore results in the same error as in the example.
If PartnerCenter.NetCore is imported first, no Az modules can be imported and result in the same error at mentioned above.
Error is thrown, stating that the next module cannot be imported.
Will share if needed
Please share additional details about your environment.
Name : ConsoleHost
Version : 6.2.0-preview.3
InstanceId : 1fac6f49-3aa2-4054-9496-ffe5b6159a84
UI : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture : en-US
CurrentUICulture : en-US
PrivateData : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled : True
IsRunspacePushed : False
Runspace : System.Management.Automation.Runspaces.LocalRunspace
ModuleType Version Name PSEdition ExportedCommands
---------- ------- ---- --------- ----------------
Script 1.0.1 Az.KeyVault Core,Desk {Add-AzKeyVaultCertificate, Update-AzKeyVaultCer...
ModuleType Version Name PSEdition ExportedCommands
---------- ------- ---- --------- ----------------
Binary 1.5.1902.2 PartnerCenter.NetCore Core,Desk {Add-PartnerCustomerCartLineItem, Add-PartnerCus...
Get-PartnerCustomerUser returns no value for LastDirectorySyncTime
We are trying to convert from the old module and the command we used before was:
Get-PCOffer -CountryId "GB" -LocaleId "en-US"
This returns PowerShell objects like a normal cmdlet so you can pass Where-Object to it.
It was achieved by this code "transformation"
function _applyTypes {
param($item,$type)
$item.PSObject.TypeNames.Insert(0, $type)
}
function _formatResult {
param ($obj, $type)
try
{
if($obj.items)
{
foreach($item in $obj.items){_applyTypes -item $item -type $type}
return $obj.items
}
}
catch
{
_applyTypes -item $obj -type $type
return $obj
}
}
Inside the command:
$response = Invoke-RestMethod -Uri $url -Headers $headers -ContentType "application/json" -Method "GET" #-Debug -Verbose
$obj += $response.Substring(1) | ConvertFrom-Json
return (_formatResult -obj $obj -type "Offer")
New command however returns a LIST... so you cannot treat is a an PS Object.
Get-PartnerOffer -CountryCode "GB" | Where-Object {$_.Name -like "Microsoft Azure"}
If you run this you will get everything returned.
Example:
$OfferTest = Get-PartnerOffer -CountryCode "GB" | Where-Object {$_.Name -like "Microsoft Azure"}
PS C:\> $OfferTest = Get-PartnerOffer -CountryCode "GB" | Where-Object {$_.Name -like "Microsoft Azure"}
$OfferTest.GetType()
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True List`1 System.Object
This is because the format is LIST in CSharp code here:
https://github.com/Microsoft/Partner-Center-PowerShell/blob/4b03067143bd80204e11394cd04c40a2c015405e/src/PowerShell/Commands/GetPartnerOffer.cs
WriteObject(
offers
.Where(o => o.IsAddOn == isAddOn && o.IsTrial == isTrial)
.Select(o => new PSOffer(o))
.ToList());
Workaround is to pass it through a loop:
$ArrayTest = @()
ForEach ($OfferStuff in $OfferTest)
{
$ArrayTest += $OfferStuff
}
$ArrayTest | Where-Object {$_.Name -like "Microsoft Azure"}
OfferId : MS-AZR-0145P
Name : Microsoft Azure
Billing : Usage
MaximumQuantity : 999999999
SupportedBillingCycles : {Monthly}
IsAddOn : False
IsTrial : False
Can the object be changed in CSharp from a list to an array please so it behaves like proper PowerShell cmdlet?
No customers is using the .onmicrosoft.com domain.
The cmdlet should support customer domain, like the MSOnline module does.
Originally posted by @skille in #32 (comment)
Hello,
What steps can reproduce the defect?
$CustomerID = Get-PartnerCustomer | select -first 1
Get-PartnerCustomerOrder -CustomerId $CustomerID.CustomerId
What is the error observed?
Get-PartnerCustomerOrder : Object reference not set to an instance of an object.
At line:1 char:1
+ CategoryInfo : NotSpecified: (:) [Get-PartnerCustomerOrder], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerOrder
$ERROR[0] | fl -force
Exception : System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Store.PartnerCenter.PowerShell.Models.Orders.PSOrder.CloneAdditionalOperations(Order order) in D:\a\1\s\src\PowerShell\Models\Orders\PSOrder.cs:line
79
at Microsoft.Store.PartnerCenter.PowerShell.Common.ResourceExtensions.CopyFrom[TInput,TOutput](TOutput value, TInput other, Action1 operation) in D:\a\1\s\src\PowerShell\Common\ResourceExtensions.cs:line 43 at Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerOrder.<>c.<GetCustomerOrders>b__14_0(Order o) in D:\a\1\s\src\PowerShell\Commands\GetPartnerCustomerOrder.cs:line 119 at System.Linq.Enumerable.WhereSelectListIterator
2.MoveNext()
at System.Management.Automation.MshCommandRuntime._WriteObjectsSkipAllowCheck(Object sendToPipeline)
at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state)
at System.Management.Automation.MshCommandRuntime.WriteObject(Object sendToPipeline, Boolean enumerateCollection)
at System.Management.Automation.Cmdlet.WriteObject(Object sendToPipeline, Boolean enumerateCollection)
at Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerOrder.GetCustomerOrders(String customerId, Nullable`1 billingCycle) in
D:\a\1\s\src\PowerShell\Commands\GetPartnerCustomerOrder.cs:line 119
at Microsoft.Store.PartnerCenter.PowerShell.Commands.PartnerPSCmdlet.ProcessRecord() in D:\a\1\s\src\PowerShell\Commands\PartnerPSCmdlet.cs:line 61
at System.Management.Automation.CommandProcessor.ProcessRecord()
TargetObject :
CategoryInfo : NotSpecified: (:) [Get-PartnerCustomerOrder], NullReferenceException
FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerOrder
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at , : line 1
PipelineIterationInfo : {}
PSMessageDetails :
PS C:> Import-Module PartnerCenter
PS C:> Connect-PartnerCenter -ApplicationId '86185200-3e87-48b4-8d00-xxxxxxxxxxxx'
Account : Microsoft.Store.PartnerCenter.PowerShell.Profile.AzureAccount
ApplicationId : 86185200-3e87-48b4-8d00-xxxxxxxxxxxx
CountryCode : CH
Environment : GlobalCloud
Locale : de-CH
PS C:> Get-PartnerCustomer
CustomerId Domain Name
xxxxxxxx-2b8c-4e04-99ee-30d42aa1745b removed.ch Removed
xxxxxxxx-84b5-44e8-b473-dbb786b234ff removed.com Removed
xxxxxxxx-0e01-4507-b1ca-2e86d798478c removed.com Removed
xxxxxxxx-b1e2-4c07-aa2c-c5e398425b9c removed.ch Removed
xxxxxxxx-8c77-470b-a4bf-0be6a84b033d removed.com Removed
PS C:> Get-PartnerCustomerRelationship -CustomerId 'xxxxxxxx-84b5-44e8-b473-dbb786b234ff'
Get-PartnerCustomerRelationship : 1002 Authorization Failed
At line:1 char:1
+ CategoryInfo : NotSpecified: (:) [Get-PartnerCustomerRelationship], PartnerPSException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.PowerShell.Exceptions.PartnerPSException,Microsoft.Store.P
artnerCenter.PowerShell.Commands.GetPartnerCustomerRelationship
What steps can reproduce the defect?
see above
Share the expected output
-> it should list the PartnerCustomerRelationship i believe
Am trying to debug the error which i receive for the below command using -debug flag. However there is no debug response and i get the same error response. This make is extremely difficult - impossible to get to the issue.
Connect-PartnerCenter -ApplicationId 0b292c96-5d35-45cc-966c- -Credential $credential -debug
Thanks,
Pradebban Raja
Get-PartnerCustomerUsageSummary -CustomerId $CustomerID
Provide Usage Summary, not sure what this should look like as testing so far as produced the same results for different test customers accounts
Get-PartnerCustomerUsageSummary -CustomerId $CustomerID
Get-PartnerCustomerUsageSummary : 3000 Customer does not have usage data.
At line:1 char:1
+ Get-PartnerCustomerUsageSummary -CustomerId $CustomerID
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Get-PartnerCustomerUsageSummary], PartnerPSException
+ FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.PowerShell.Exceptions.PartnerPSException,Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerUsageSummary
Windows 10
PowerShell 5.1
PartnerCenter 1.5.1902.3
When running the following command today, which falls on the last day of billing cycle date, I get an exception. It worked fine when running on any other day (when today in UTC < $EndTime).
Steps to reproduce
Connect-PartnerCenter -ApplicationId -Credential $credential
$usage = Get-PartnerCustomerSubscriptionUtilization -CustomerId -SubscriptionId -StartDate -EndDate -Granularity Daily -ShowDetails
Expected behavior
$usage contains collection of records.
Actual Results
Get-PartnerCustomerSubscriptionUtilization: Value cannot be null.
Parameter name: resourceCollection
at Microsoft.Store.PartnerCenter.Enumerators.BaseResourceCollectionEnumerator1..ctor(IPartner rootPartnerOperations, T resourceCollection, JsonConverter resourceCollectionConverter) at Microsoft.Store.PartnerCenter.Factory.IndexBasedCollectionEnumeratorFactory
2.Create(TResourceCollection resourceCollection)
at Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerSubscriptionUtilization.ExecuteCmdlet()
at Microsoft.Store.PartnerCenter.PowerShell.Commands.PartnerPSCmdlet.ProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
Environment
Windows 10 Version 1803
PowerShell 5.1.17134.228
PartnerCenter 1.5.1811.4
(tried on 1.5.1812.1 with same results)
In Azure Functions I've uploaded the Partnercenter module 1.5.1810.6 using FTP. I've loaded the module from within the Azure function successfully. After this I called:
$ApplicationId = 'xxxxxxx'
Connect-PartnerCenter -ApplicationId $ApplicationId -Credential $O365Credential
This should connect me to the PartnerCenter.
The error I get is that the parameter: ID is not found
: A parameter cannot be found that matches parameter name 'id'.
at run.ps1: line 45
+
+
+ CategoryInfo : InvalidArgument: (:) [Connect-PartnerCenter], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Store.PartnerCenter.PowerShell.Commands.ConnectPartnerCenter,run.ps1
Using Get-PartnerCustomerSubscriptionUtilization -CustomerId $customer.CustomerId -SubscriptionId $subscription.SubscriptionId -StartDate (Get-Date).AddMonths(-1).ToUniversalTime() -granularity Hourly -ShowDetails -EndDate (Get-Date).ToUniversalTime()
will give a validation error for end date because it is not a GUID.
Entering an end date should give me all usage data up to the date specfied.
I get a validation error stating:
Get-PartnerCustomerSubscriptionUtilization : Das Argument für den Parameter "EndDate" kann nicht überprüft werden. Das Argument "9/20/2018 12:00:00 AM +00:00" entspricht nicht dem Muster
"^({){0,1}[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}(}){0,1}$".
Why?
/// <summary> /// Gets or sets the end date (in UTC) of the usages to filter. /// </summary> [Parameter(HelpMessage = "The end date (in UTC) of the usages to filter.", Mandatory = false)] [ValidatePattern(@"^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", Options = RegexOptions.Compiled)] public DateTimeOffset? EndDate { get; set; }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.