A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
Azure Billing Data Incorrect
Gaurav Singh
130
Reputation points
Hello Team,
I have a problem with the Azure Billing Data that I do retrieve using curl on my Linux system.
When I verified the billing data, I get in response to my Curl request the results were incorrect intermittently, I am observing this multiple times in a month. I made repeated requests still I get the same values that are incorrect.
I have obtained the billing details from the GUI Portal to compare the data.
while true; do response=$(curl -s -X POST -H "Authorization: Bearer ${access_token}" -H "Content-Type: application/json" -d '{ "type": "Usage", "timeframe": "Custom", "timePeriod": { "from": "'"${three_days_ago}T00:00:00Z"'", "to": "'"${three_days_ago}T23:59:59Z"'" }, "dataset": { "granularity": "Daily", "aggregation": { "totalCost": { "name": "Cost", "function": "Sum" } }, "grouping": [ { "type": "Dimension", "name": "InvoiceSection" }, { "type": "Dimension", "name": "SubscriptionId" }, { "type": "Dimension", "name": "SubscriptionName" } ] } }' "https://management.azure.com/providers/Microsoft.Billing/billingAccounts/${billing_account_id}/providers/Microsoft.CostManagement/query?api-version=2019-11-01")
if [[ $response == *"\"error\":{\"code\":\"429\""* ]]; then
retry_count=$((retry_count+1))
if [[ $retry_count -gt $MAX_RETRIES ]]; then
echo "Exceeded maximum number of retries."
break
fi
echo "Received error response. Retrying in $RETRY_DELAY seconds..."
sleep $RETRY_DELAY
else
break
fi
done
Cost Management
Cost Management
Sign in to answer