Reputation: 271
I have 2 azure subsription. Today,I found that suddently 2000 Rs. didcuted from my one of the subsription. When I have started insvestigating for the resource which has consumed maximun unit, I found on preview portal that perticular Resource Guid has eaten the max amount. But I want to know which Azure resource (e.g.VM or SQL DB etc) or which accout user (Login ID of the user who has created that resource) is eating this amount.
One more thing, I found this sudden cost cutting thing for both of the subscription on almost same day when around 13 to 14 days remaining.So is there is any billing cycle runs after each 3 weeks or something like that ?
Upvotes: 22
Views: 29982
Reputation: 743
As previously mentioned, the ResourceGuid or MeterId
as it is represented in PowerShell is not necessarily unique to a specific resource, but rather an unique id of a class of thing (like a B2ms virtual machine instance running hours). BUT, you can get the ResourceId through the Get-AzConsumptionUsageDetail commandlet
So, for example, if you want to get the list of instances for the ResourceGuid "7a65b178-2133-400b-8e4c-7b8eeda86d81" (which corresponds to running hours for a Standard_A2_v2 VM instance, BTW)
$BillName = "202010-1"
$ResourceGuid = "7a65b178-2133-400b-8e4c-7b8eeda86d81"
Get-AzConsumptionUsageDetail -IncludeMeterDetails -IncludeAdditionalProperties -BillingPeriodName $BillName | Where-Object {$_.SubscriptionGuid -eq (Get-AzContext).Subscription.Id} | Where-Object {$_.MeterId -eq $ResourceGuid} | Select-Object -Property InstanceId -Unique
The fetch of the Get-AzConsumptionUsageDetail can take a long time so I always pull that down once and put it in a variable and then perform the filtering and searching from there. Usually, what you want is to filter on the Unique ResourceId and then add up all the BillingDetails for that ID so you can figure out exactly how much each resource is costing you.
Upvotes: 0
Reputation: 351
Unfortunately, the "Resource Guid" property on the "Resource costs" blade in the new Azure Portal is merely a deployment GUID for billing purposes on a specific resource, and cannot be directly used to identity the resource name.
If you refer to the page Understand your bill for Microsoft Azure, you can see the description for the "Resource GUID" property:
The billed meter identifier. This is used as the identifier used to price billing usage.
If you'd like to manually know the resource name which you are being billed for you can log into the Azure Account Center, click "Billing History" and download the usage details for the current period. This information is being updated daily, and you even get usage information with a daily breakdown.
Upvotes: 18