Az-SearchGraph to query Cost Management Views

Guha, Satyaki 0 Reputation points
2023-12-01T12:00:57.75+00:00

Hi Team, I have been trying to query the cost views present within my subscription and resource view scope using azure resource graph query but without any luck. My best bet is I am not querying the right resource. Can anyone please help me in this.

My end goal is to retrieve a list of cost views present within my azure cost management portal at subscription & resource group scope with the help of Search-AzGraph,.

Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,349 questions
{count} votes

1 answer

Sort by: Most helpful
  1. tbgangav-MSFT 10,421 Reputation points
    2023-12-02T05:02:10.72+00:00

    Hi @Guha, Satyaki ,

    As per this REST API, cost views resource provider is Microsoft.CostManagement/views and as per this Azure document, cost views related resource type is currently not supported so you might not be able to query cost view using Search-AzGraph PowerShell cmdlet. I am reaching out to Azure Resource Graph product team to confirm the same and see if we have any workaround for this. Will keep you updated as I hear more information.

    Meanwhile, on the other hand, if your requirement is to get the cost views using PowerShell approach, then you may try the below approach which runs the cost views REST API using Invoke-AzRestMethod PowerShell cmdlet.

    Invoke-AzRestMethod -Method GET -Uri https://management.azure.com/providers/Microsoft.CostManagement/views?api-version=2023-03-01
    
    0 comments No comments