finopsfoundation / focus_converters

Parent repository to hold all common documentation and code samples for all FOCUS Converter projects
MIT License
77 stars 43 forks source link

Supported Azure APIs #331

Open ksysiekj opened 6 months ago

ksysiekj commented 6 months ago

hello, What MS Azure APIs are supported by the converter? In the project currently I'm working on we use the managment.azure.com Api (https://learn.microsoft.com/en-us/rest/api/cost-management/generate-cost-details-report/create-operation?view=rest-cost-management-2023-11-01&tabs=HTTP) to generate usage details for both EA and CSP (cannot use azure.portal > Cost Management > Usage + Charges > Download option) however when I try to convert the generated usage report I'm facing issues.

  1. EA

a) EA request to generate an usage report:

POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingScope}/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2023-08-01
{
    BillingPeriod=billingPeriod  // eg 202403 for march 2024
}

for this report converter works as expected

b) MCA request to generate an usage report:

POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{bllingScope}/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2023-08-01
{
    TimePeriod={
        Start=startDate,
        End=endDate
    }
}

report generated using this API throws an error when using the converter: ValueError: Column(s) 'AvailabilityZone, BillingAccountId, BillingAccountName, BillingCurrencyCode, BillingPeriodEndDate, BillingPeriodStartDate, ChargeType, ConsumedService, CostInBillingCurrency, Date, Frequency, PricingModel, PublisherName, Quantity, ResourceLocation, ResourceName, SubscriptionName' not found in data

c) PayG request to generate an usage report: GET https://management.azure.com/subscriptions/{billingScope}/providers/Microsoft.Consumption/usageDetails/download?api-version=2019-10-01&$filter=properties/usageStart ge '{startDate}' AND properties/usageEnd le '{endDate}'

report generated using this API throws an error when using the converter: ValueError: Column(s) 'BillingCurrencyCode, CostInBillingCurrency, PricingModel, ProductName, benefitId, benefitName' not found in data

  1. CSP request to generate an usage report:
    POST https://management.azure.com/providers/Microsoft.Billing/billingAccounts/{billingAccountName}/customers/{customerId}/providers/Microsoft.CostManagement/generateCostDetailsReport?api-version=2023-11-01
    {
    TimePeriod={
        Start=startDate,
        End=endDate
    }
    }

    report generated using this API throws an error when using the converter: ValueError: Column(s) 'AvailabilityZone, BillingAccountId, BillingAccountName, BillingCurrencyCode, BillingPeriodEndDate, BillingPeriodStartDate, ChargeType, ConsumedService, CostInBillingCurrency, Date, Frequency, PricingModel, PublisherName, Quantity, ResourceLocation, ResourceName, SubscriptionName' not found in data

Can you please specify what azure APIs are supported by the converter?