I’m trying to download the budgets we have created in root scope in azure, but not able to.
I tried using Get-AzConsumptionBudget
but it does not give result for root management group but only for subscription level and resource group level.
Get-AzManagementGroup -GroupId "groupID" | Get-AzConsumptionBudget
I’m getting error like
Get-AzConsumptionBudget : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the
input and its properties do not match any of the parameters that take pipeline input.
2
Answers
To download or export budget details created in the root scope of the Azure portal or using PowerShell, you can follow these steps:
Azure Portal:
Log in to the Azure portal.
Navigate to the "Cost Management + Billing" section.
In the left sidebar, select "Cost Management" and then "Budgets."
Find and select the budget you want to export.
Once on the budget details page, look for an "Export" or "Download" option. This may be in the form of a button or an option within the menu.
First of all, if you want to see the root and the resources in it, you need to enable the "Access management for Azure resources"
Reference and help: Elevate access to manage all Azure subscriptions and management groups
Reference: Understand and work with scopes
So I think that what you want in this context is not achievable.
But! You can use the
Get-AzManagementGroup
command to query all subscriptions within the root.You can then iterate through all the subscriptions (
Set-AzContext
) and then query the budgets (Get-AzConsumptionBudget
).You can of course store these in an object on the fly and save them to a csv (or whatever) file at the end.
Something like this:
Side note: make sure that you have c:temp or replace it with your path.
MinimalDetails csv file:
If this is what you were looking for, please accept the answer.
If you have any other questions, please feel free to ask.