I have a few Service Bus Namespaces in my Azure Subscription. Some of them are in Basic and some in Standard tier. What I want to do is find out the cost of each Namespace separately.
I have looked at the pricing page
and it is my understanding that for Service Bus Namespaces in Standard tier, there's a base charge of $0.0135/hour
(BTW, the pricing page conveniently omitted the fact that this pricing is at the Azure Subscription level and not at the Namespace level) and then there's a cost per operation (e.g. first 13 M operations per month are free and then the next 87 M operations are charged at the rate of $0.80 per million operations
).
This is all fine and very straight forward. The problem comes when I use Cost Management API to get the costs for a Service Bus Namespace (https://docs.microsoft.com/en-us/rest/api/cost-management/query/usage).
What I am observing is that Cost Management API reports only operations costs against the actual Namespace however the base charge is reported under a different namespace all together. The name of that namespace is $system
and is under $system
resource group.
There's a blurb about $system
Namespace here
which states:
Azure Service Bus recently upgraded the billing components. Because of this change, if you have a Service Bus Standard namespace, you may see line items for the resource '/subscriptions/<azure_subscription_id>/resourceGroups/$system/providers/Microsoft.ServiceBus/namespaces/$system' under resource group '$system'.
These charges represent the base charge per Azure subscription that has provisioned a Service Bus Standard namespace.
It's important to note that these charges aren't new, that is, they existed in the previous billing model too. The only change is that they're now listed under '$system'. It's done because of constraints in the new billing system that groups subscription level charges, not tied to a specific resource, under the '$system' resource ID.
Which is again fine.
What my confusion is how should I calculate the total cost of an individual Service Bus Namespace.
For a Service Bus Namespace in Standard tier should the formula be:
Total cost = Total operations cost for that Namespace + Prorated cost reported for $system Namespace
where
Prorated cost = Cost reported for $system Namespace / Total number of Standard Service Bus Namespaces
Is this formula correct?