samedi 20 août 2022

Azure - Get Billing cost for specified date using Ruby

How can I get the billing cost for specified date using ruby? I tired following this document but it returns nothing. I want to fetch the cost for last 15 days or 30 days.

I'm not sure if I should enable something in portal if this needs to work?

https://www.rubydoc.info/gems/azure-armrest/0.3.2/Azure/Armrest/Billing/UsageService

The following code returns nothing. No errors either.

require 'azure/armrest'

conf = Azure::Armrest::Configuration.new(
  :client_id       => '123456',
  :client_key      => '123456',
  :tenant_id       => '123456',
  :subscription_id => '123456'
)  



BILLING = Azure::Armrest::Billing::UsageService.new(conf)  
  
options = {:reportedStartTime => '2022-07-01T00:00:00Z', :reportedEndTime => '2022-07-31T00:00:00Z', :aggregationGranularity  => 'Daily', :ShowDetails => 'true'}
    

test = BILLING.list(options)

Aucun commentaire:

Enregistrer un commentaire