Giter Site home page Giter Site logo

microsoft / partner-center-powershell Goto Github PK

View Code? Open in Web Editor NEW
126.0 28.0 54.0 5.71 MB

PowerShell module for managing Partner Center resources.

Home Page: https://docs.microsoft.com/powershell/partnercenter/

License: MIT License

C# 98.94% PowerShell 1.06%
partnercenter powershell module csp azure office365 partner-center partner-center-api

partner-center-powershell's Introduction

Partner Center PowerShell

Build Status Deployment status

PartnerCenter GitHub issues GitHub pull-requests

Partner Center PowerShell is commonly used by partners to manage their Partner Center resources. It is an open source project maintained by the partner community. Since this module is maintained by the partner community, it is not officially supported by Microsoft. You can get help from the community or open an issue on GitHub.

Requirements

Partner Center PowerShell works with PowerShell 5.1 or higher on Windows, or PowerShell Core 6.x and later on all platforms. If you aren't sure if you have PowerShell, or are on macOS or Linux, install the latest version of PowerShell Core.

To check your PowerShell version, run the command:

$PSVersionTable.PSVersion

To run Partner Center PowerShell in PowerShell 5.1 on Windows:

  1. Update to Windows PowerShell 5.1 if needed. If you're on Windows 10, you already have PowerShell 5.1 installed.
  2. Install .NET Framework 4.7.2 or later.

There are no additional requirements for Partner Center PowerShell when using PowerShell Core.

Install the Partner Center PowerShell module

The recommended install method is to only install for the active user:

Install-Module -Name PartnerCenter -AllowClobber -Scope CurrentUser

If you want to install for all users on a system, this requires administrator privileges. From an elevated PowerShell session either run as administrator or with the sudo command on macOS or Linux:

Install-Module -Name PartnerCenter -AllowClobber -Scope AllUsers

By default, the PowerShell gallery isn't configured as a trusted repository for PowerShellGet. The first time you use the PSGallery you see the following prompt:

Untrusted repository

You are installing the modules from an untrusted repository. If you trust this repository, change
its InstallationPolicy value by running the Set-PSRepository cmdlet.

Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"):

Answer Yes or Yes to All to continue with the installation.

Discovering cmdlets

Use the Get-Command cmdlet to discover cmdlets within a specific module, or cmdlets that follow a specific search pattern:

# List all cmdlets in the PartnerCenter module
Get-Command -Module PartnerCenter

# List all cmdlets that contain Azure
Get-Command -Name '*Azure*'

# List all cmdlets that contain Azure in the PartnerCenter module
Get-Command -Module PartnerCenter -Name '*Azure*'

Cmdlet help and examples

To view the help content for a cmdlet, use the Get-Help cmdlet:

# View the basic help content for Get-PartnerCustomerSubscription
Get-Help -Name Get-PartnerCustomerSubscription

# View the examples for Get-PartnerCustomerSubscription
Get-Help -Name Get-PartnerCustomerSubscription -Examples

# View the full help content for Get-PartnerCustomerSubscription
Get-Help -Name Get-PartnerCustomerSubscription -Full

# View the help content for Get-PartnerCustomerSubscription on https://docs.microsoft.com
Get-Help -Name Get-PartnerCustomerSubscription -Online

partner-center-powershell's People

Contributors

baileylawson avatar idwilliams avatar joelst avatar microsoftopensource avatar msftgits avatar stefanschoof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

partner-center-powershell's Issues

Get-PartnerCustomerOffer - Returns LIST instead of Array

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?

Package missing

Steps to reproduce

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

Expected behavior

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.

Actual behavior

Throws an error

Diagnostic logs

Will be shared if needed

Environment

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

Get-PartnerCustomerUsageSummary throws converting exception

Steps to reproduce

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.

Expected behavior

should return Customer Usage Summary

Actual behavior

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

Environment

Windows 10 Enterprise 1709
PowerShell 5.1 Build 16299 Revision 611

Get-PartnerInvoiceLineItem for Azure

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.

New-PartnerCustomerAgreement Breaking change

Steps to reproduce

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 behavior

Expected output was to complete successfully

Actual behavior

Behavior was error

Diagnostic logs

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.

Environment

 PartnerCenter 1.5.1812.1 
PS C:\WINDOWS\system32> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      17763  134

New-PartnerCustomer does not work - Bad Request

Steps to reproduce

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

Environment

Get-Module -Name PartnerCenter

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   1.0.1808.2 PartnerCenter                       {Add-PartnerCustomerCartLineItem, Add-PartnerCustomerUserRoleMember, Connect-PartnerCenter, Get-PartnerAgreementDetail...}

Cannot load the module in PS Core

Steps to reproduce

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

Expected behavior

Share the expected output

Successful import

Actual behavior

What is the behavior observed?

error

Diagnostic logs

Please share test platform diagnostics logs.
The logs may contain test assembly paths, kindly review and mask those before sharing.'

provided

Environment

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

Set-PartnerCustomer cmdlet doesn't use input parameters

Expected behavior

Set-PartnerCustomer should update the customer billing profile using the given input parameters if they are non-null and valid.

Actual behavior

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.

Environment

Using PartnerCenter V1.0.1809.6 from the PowerShell Gallery

Azure automation, importing module

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..

Api has more info than Powershell Module

Feature Request

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

Get-PartnerCustomerAgreement not working

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.

Get-PartnerIndirectReseller : 1002 Authorization Failed

Maybe related to #49?

Steps to reproduce

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...}

Expected behavior

Expect to see a list of indirect resellers

Actual behavior

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

Environment

Windows 10
PowerShell 5.1

Add-PartnerCustomerUserRoleMember doesn't work

Steps to reproduce

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

Actual behavior

It throws an error because CustomerId even it's ok.

Diagnostic logs

Please share test platform diagnostics logs.
The logs may contain test assembly paths, kindly review and mask those before sharing.

Environment

Get-Module PartnerCenter | select Name,Version

Name          Version   
----          -------   
PartnerCenter 1.5.1902.5

image

New-PartnerCustomerOrder Addon Order throws "2000" error

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."

Steps to reproduce

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 :

Expected behavior

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.

Actual behavior

Error thrown
"New-PartnerCustomerOrder : 2000 ParentSubscriptionId is not supported for this request."

Environment

PartnerCenter v1.5.1812.1
PSVersion v5.0.10586.117

Unable to to use set-partnercustomersubscription, PartnerPSException

Steps to reproduce

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.

Expected behavior

Update the Quantity of a specific subscription

Actual behavior

Set-PartnerCustomerSubscription :
At line:1 char:1

  • Set-PartnerCustomerSubscription -CustomerId 7daa9b5f-a076-...
  •   + 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.

Environment

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

Get-PartnerCustomerUsageSummary not accepting application credentials

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)

Service Principal connection

$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

  • ... lingSummary = Get-PartnerCustomerUsageSummary -CustomerId $CustomerId
  •               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Get-PartnerCustomerUsageSummary], PartnerException
    • FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.Exceptions.PartnerException,Microsoft.Store.PartnerCenter.
      PowerShell.Commands.GetPartnerCustomerUsageSummary

Connect-PartnerCenter does not support MFA

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

  • Connect-PartnerCenter -Credential $myO365cred -ApplicationId xxxxxxx...
  •   + CategoryInfo          : NotSpecified: (:) [Connect-PartnerCenter], AdalServiceException
      + FullyQualifiedErrorId : Microsoft.IdentityModel.Clients.ActiveDirectory.AdalServiceException,Microsoft.Store.PartnerCenter.PowerShell.Commands.ConnectPa
     rtnerCenter`
    

End Time provided but can't be seem by api

I tried folowing rest call exactly like in the microsoft docs but the error says that i don't provided an end time. The end time is provided and is a valid format. Does anyone see if this is my fault , or a bug in the rest api ?
image

Unable to retrieve AzureOfferTerm object from the RateCard API/Cmdlet

Steps to reproduce

Run - Get-PartnerAzureRateCard -Currency GBP -Region 'GB' - doesn't include the AzureOfferTerm object

Expected behavior

To include the object described here - https://docs.microsoft.com/en-us/partner-center/develop/azure-rate-card#azureofferterm

Actual behavior

Includes a truncated version of the AzureMeter object but not the AzureOfferTerm :(

Diagnostic logs

Available if there is a guide on how to extract these

Environment

Windows 10
Latest module version

New-PartnerCustomerAgreement - Date of agreement cannot be greater than the current date

Steps to reproduce

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

Expected behavior

When texted a few weeks ago, the same code succeeded with no errror

Actual behavior

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

Environment

PSVersion: 5.1.17763.1
winver: 1809 build 17763.55
Module Version : 1.5.1810.2

Get-PartnerCustomerOrder -CustomerID $ID

Hello,

Steps to reproduce

What steps can reproduce the defect?
$CustomerID = Get-PartnerCustomer | select -first 1
Get-PartnerCustomerOrder -CustomerId $CustomerID.CustomerId

Actual Error

What is the error observed?
Get-PartnerCustomerOrder : Object reference not set to an instance of an object.
At line:1 char:1

  • Get-PartnerCustomerOrder -CustomerId $CustomerID.CustomerId
  •   + CategoryInfo          : NotSpecified: (:) [Get-PartnerCustomerOrder], NullReferenceException
      + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerOrder
    
    

Diagnostic logs

$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.WhereSelectListIterator2.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 :

'ServicePrincipal' parameter missing from New-PartnerAccessToken

Steps to reproduce

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:

Expected behavior

Share the expected output
Getting token succesfully

Actual behavior

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.

Diagnostic logs

Please share test platform diagnostics logs.
The logs may contain test assembly paths, kindly review and mask those before sharing.

provided

Environment

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

Connect-PartnerCenter -AccessToken not working in 1.5.1902.1

Steps to reproduce

$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

Expected behavior

Should connect to PartnerCenter

Actual behavior

It throws an error (the -AccessToken parameter is not in the cmdlet)

Diagnostic logs

Please supply commands to produce. Then I'd be glad to upload.

Environment

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.

PartnerCenter.NetCore and Az.KeyVault cannot coexist

Steps to reproduce

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:\>

Expected behavior

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.

Actual behavior

Error is thrown, stating that the next module cannot be imported.

Diagnostic logs

Will share if needed

Environment

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...

Retrieve ImmutableID with Get-PartnerCustomerUser

Feature Request

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.

Remove-PartnerResellerRelationship - error 3000 - cannot delete the relationship

Steps to reproduce

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

Expected behavior

Relationship should be removed. That used to work in old module every time.

Actual behavior

Error 3000.

Environment

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?

Get-PartnerCustomerSubscriptionUtilization Parameter Validation Error

Steps to reproduce

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.

Expected behavior

Entering an end date should give me all usage data up to the date specfied.

Actual behavior

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}$".

See:
https://github.com/Microsoft/Partner-Center-PowerShell/blob/master/src/PowerShell/Commands/GetPartnerCustomerSubscriptionUtilization.cs

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; }

Differnet results between PowerShel and Automation Module

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

Get-PCUsage compatitble command

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

Get-PartnerCustomerRelationship -> results in 1002 Authorization Failed

Steps to reproduce

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

  • Get-PartnerCustomerRelationship -CustomerId 'xxxxxxxx-84b5-44e8-b473- ...
  •   + 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

Expected behavior

Share the expected output

-> it should list the PartnerCustomerRelationship i believe

Unable to Debug Connect-PartnerCenter cmdlet

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

Download reconciliation file

Feature Request

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

Get-PartnerCustomerUsageSummary : 3000 Customer does not have usage data.

Steps to reproduce

Get-PartnerCustomerUsageSummary -CustomerId $CustomerID

Expected behavior

Provide Usage Summary, not sure what this should look like as testing so far as produced the same results for different test customers accounts

Actual behavior

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

Environment

Windows 10
PowerShell 5.1
PartnerCenter 1.5.1902.3

Cannot retrieve usage data when running on the billing date

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.IndexBasedCollectionEnumeratorFactory2.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)

Get-PartnerContract -DomainName FQDN

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

Can't log in

Steps to reproduce

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

The supplied role does not have the rights to perform the requested operation

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.

Connect-PartnerCenter help should be updated to current definition

Steps to reproduce

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.

Expected behavior

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

Actual behavior

What is the behavior observed?

Diagnostic logs

Please share test platform diagnostics logs.
The logs may contain test assembly paths, kindly review and mask those before sharing.

Environment

Please share additional details about your environment.
Version

Need some basic help

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

Get-PartnerCustomerSubscriptionUtilization error on some subscriptions only

Steps to reproduce

Connect-PartnerCenter -ApplicationId <GUID> -Credential $credential

$usage = Get-PartnerCustomerSubscriptionUtilization -CustomerId <GUID> -SubscriptionId <GUID> -StartDate <Date> -EndDate <Date> -Granularity Daily -ShowDetails

Expected behavior

Data from same subscriptions is retrieved properly with PartnerCenterModule 0.10.0.5

Actual behavior

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()

Environment

Windows 10 Version 1803
PowerShell 5.1.17134.228
PartnerCenter 1.5.1810.2

A parameter cannot be found that matches parameter name 'id'

Steps to reproduce

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

Expected behavior

This should connect me to the PartnerCenter.

Actual behavior

The error I get is that the parameter: ID is not found

Diagnostic logs

: 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

Need to be able to query CompanyProfile Email

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:

https://github.com/Microsoft/Partner-Center-PowerShell/blob/master/src/PowerShell/Models/Customers/PSCustomer.cs

        /// <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;
}

Connect-PartnerCenter with client secret

Feature Request

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?

Support MFA for App+User Authentication

Feature Request

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)

Create a resource uri value inside the command Get-PartnerCustomerSubscriptionUsage

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 !!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.