Partner-Center-PowerShell icon indicating copy to clipboard operation
Partner-Center-PowerShell copied to clipboard

Cannot get tenant subscription list if tenant has an expired subsctiption.

Open DavidMoore-intY opened this issue 3 years ago • 10 comments

Steps to reproduce

Run 'Get-PartnerCustomerSubscription' against a tenant with an expired subscription

Expected behavior

List of subscriptions on the tenant is returned

Actual behavior

Get-PartnerCustomerSubscription : Requested value 'Expired' was not found. At line:1 char:2

  • Get-PartnerCustomerSubscription -CustomerId ________---____- ...
  •  + CategoryInfo          : CloseError: (:) [Get-PartnerCustomerSubscription], ArgumentException
     + FullyQualifiedErrorId : Microsoft.Store.PartnerCenter.PowerShell.Commands.GetPartnerCustomerSubscription
    
    

Diagnostic logs

Running with -debug shows data being returned from Microsoft as expected. Logs not included as it is a live customer tenant.

Environment

PSVersion 5.1.18362.1801
PSEdition Desktop

ModuleType Version Name


Script 3.0.10 PartnerCenter

DavidMoore-intY avatar Mar 25 '22 12:03 DavidMoore-intY

Having this exact issue as well. Suspending the subscription doesn't seem to fix this and I'm unable to cancel the expired subscription.

aunCoreyGood avatar May 04 '22 17:05 aunCoreyGood

@aunCoreyGood I've ended up implementing the calls I need myself as separate functions

Function Get-MSCustomerSubscriptions {

    [CmdletBinding()]
    Param (
        [Parameter(Mandatory = $true)]
        [GUID]$TenantID
    )

    $result = (Invoke-RestMethod -Method GET -URI "https://api.partnercenter.microsoft.com/v1/customers/$TenantID/subscriptions" -Authentication Bearer -Token Get-MSAccessToken)
    
    Return $Result.items

}

Get-MSAccessToken is specific to my environment, but once you've implemented a way to get a token all the rest is fairly easy.

DavidMoore-intY avatar May 05 '22 13:05 DavidMoore-intY

On a similar note, the BillingCycle 'Triennial' isn't supported by the powershell module so anything that involves getting details of a product that supports that billing type will fail.

DavidMoore-intY avatar May 06 '22 15:05 DavidMoore-intY

Having the same issue. The Expired subscription is showing in the Debug output, but the module does not know how to handle the expired status it seems. I will try your workaround David.

TheSTHDK avatar May 18 '22 21:05 TheSTHDK

Any chance this is going to get fixed soon?

mwasham avatar Oct 28 '22 13:10 mwasham

Any chance this is going to get fixed soon?

I sure hope so - I have this issue as well

ezcodify avatar Dec 07 '22 18:12 ezcodify