question

olegarr avatar image
0 Votes"
olegarr asked olegarr commented

Azure Powershell Resource Group Cost

Hello:

Is there a way to get the Cost of single Azure Resource Group (only) via PowerShell? Of course, the cost should include the cost of all resources in this RG...

Thank you!

windows-server-powershellazure-automanage
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AndreasBaumgarten avatar image
0 Votes"
AndreasBaumgarten answered olegarr commented

Hi @olegarr ,

maybe this is helpful.

You need to install and import the Az PowerShell module for this.

 # All information
 Get-AzConsumptionUsageDetail -ResourceGroup "demo-rg" -StartDate 2021-12-01 -EndDate 2022-01-27 |  Select-Object *
    
 #  Just some details
 Get-AzConsumptionUsageDetail -ResourceGroup "demo-rg" -StartDate 2022-01-01 -EndDate 2022-01-27 | Select-Object InstanceName, Currency, PretaxCost | Sort-Object -Property PretaxCost -Descending


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@AndreasBaumgarten Baumgarten,

Thanks a lot! Exactly what I needed... for some reason I missed something when tried myself ;-)

Thank you!

0 Votes 0 ·