Cannot get tenant subscription list if tenant has an expired subsctiption.
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
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 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.
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.
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.
Any chance this is going to get fixed soon?
Any chance this is going to get fixed soon?
I sure hope so - I have this issue as well