Public/CloudFactory/Get-CFMSSubscriptions.ps1
|
function Get-CFMSSubscriptions { [CmdletBinding()] param ( [Parameter(Mandatory = $true)] [PSCustomObject]$CustomerObject ) try { if ($null -eq $CustomerObject.externalServices.MICROSOFT -or $CustomerObject.externalServices.MICROSOFT -eq '') { Write-ModuleLog -Message "Customer $($CustomerObject.name) does not have a Microsoft tenant attached" -Level Verbose -Component 'CloudFactoryAPI' return $null } $CustomerId = $CustomerObject.id $result = Invoke-CFApi -Method GET -Uri "v2/microsoft/customer/$CustomerId/subscriptions" return $result } catch { Write-ModuleLog -Message "Failed to fetch MS Subscriptions for customer $($CustomerObject.name)" -Level Error -Component 'CloudFactoryAPI' -ErrorRecord $_ throw $_ } } |