Public/Curanet/M365/Get-CuranetM365AzureBilling.ps1
function Get-CuranetM365AzureBilling() { Param( [Parameter(Mandatory)] [string]$SubscriptionId, [Parameter(Mandatory)] [ValidateSet("3370", "3850")] [string]$Account, [Parameter(Mandatory)] [DateTime]$StartDate, [Parameter(Mandatory)] [DateTime]$EndDate ) $Body = @{ startDate = $StartDate endDate = $EndDate costType = "Usage" timeFrame = "Custom" } try { $AzureBilling = Invoke-CuranetAPI -Account $Account -Uri "https://api.curanet.dk/microsoft365/v1/Subscriptions/$($SubscriptionId)/Azurebilling/Query" -Method POST -Body $Body } catch { throw "Failed to retreive Azure Billing from Curanet $($Account) API: $_" } return $AzureBilling } |