I am building an Azure Chargeback solution and for that I am pulling the Azure Usage data from Azure Billing REST APIs for multiple subscriptions and different dates. I need to store this into custom MS SQL database as per customer’s requirements. I get various usage records from Azure.
- Problem: From these Usage records, I am not able to find any combination of the columns in the data I receive which will give me a Unique Key to identify a Usage record for a particular subscription and for a specific date. Only column I see as different is Quantity but even that can be duplicated. E.g. If there are 2 VMs of type A1 with no data or applications on them, in the same cloud service, then they will have exact quantity of usage. I do not get the exact name of the VM or any other resource via the Usage APIs.
- One Custom Solution (Ineffective): I can append a counter or unique ID to the usage records but if I fetch the data next time the order may shuffle or new data may be introduced thereby affecting the logic for uniqueness. Any logic I build to checking if any data is missing in DB will result in bugs if there is any alteration in the order the usage records are returned (for a specific subscription for a specific date).
I am sure that Microsoft stores this data in some database. I can’t find the unique id to identify a usage record from many records returned by the Billing API. Maybe I am missing something here.
I will appreciate any help or any pointers on this.