Today I was helping a customer look at a perceived discrepancy between the billing shown in the preview feature Cost Management and Billing in the Azure Portal and the detailed usage download from the Enterprise Agreement portal. I wanted to share my findings.
Our customer has a P2 App Service Environment deployed with one App Service which services their application in a pre-production environment. The same configuration exists and the same behaviour is also present in the production environment.
This issue starts off in the Cost Management + Billing feature of Microsoft Azure. Under Billing Account on the blade, click Subscriptions and you should be presented with a screen showing you both “My subscriptions” which is ones you are an owner of and “Other subscriptions” where you have appropriate access to view billing data. Clicking a subscription will give you a nice overview of the spending rate and forecast spend over the current billing period. Click on Cost analysis and you will see a whole host of data presented.
What you can see from the screenshot above is that on the face of it we are getting billed for four resources, these resources are:
- Our actual App Service
When we download the detailed usage CSV from the EA Portal, and scope it down to see the same resources we get something similar to what we see below (it’s not a friendly file to see).
I want to highlight a few of the columns in here which are important:
- Column I is the meter ID, this is the unique meter identifier used in billing, resources may well have more than one meter associated with them.
- Column N is the quantity of the meter consumed, generally in Azure this unit is in hours or even GB for storage.
- Column O is the resource rate, this is the rate of one unit from column N.
- Column P is the basic cost, N x O of running the resource.
I’ve hidden a couple of columns here for the date, which is split into three columns of year, month and day. Each line in this spreadsheet represents a specific day per meter so this spreadsheet will be pretty large. This one is 11 MB for example.
So what is all this about, well first in the portal we are listing four resources, but looking at the detailed usage statement we only see three resources. This can cause quite a simple confusion as to what we are actually getting billed for.
With the Cost analysis sections expanded, what you can see here expanded are the meter IDs. What this shows us is that the top two resources, the FrontEnd_Pool for both the App Service Environment and App Service are actually the same meter. So this is a combined cost. This can be seen in the detailed CSV where we are billed for 48 hours instead of 24 hours.
Calculating the Cost
To make this all add up is fairly simple. In the Azure Portal the top two resources added together come to a total cost of 545.35, this is by adding 99.69 and 445.66. In the detailed CSV we can get to this figure by one simple calculation. This is column P times by the number of days in the month. In this case 17.592 x 31 = 545.352.
There we have the cost, so the confusion here is the portal splitting out the same meter ID, this is done because both resources are technically different, one is an App Service Environment and one is an App Service. However, with the CSV showing the same, in my opinion, they should be shown as one resource.
What are These Resources?
Now the billing is cleared up, you might be asking what on earth are the resources FrontEnd_Pool and Unused_Pool? They don’t appear in the portal, clicking "Go to resource" in the portal leads to an error page and I didn’t deploy them, so what are they?
Both of these resources are deployed automatically with an App Service Environment, you can’t see them in the portal but it’s part of how it works. So the cost is as expected, the breakdown however because of these is not expected.
There you have it, hope this post explains a little more the discrepancy I’ve seen here and helps in the future.