Breakdown usage per resource

Joseph Kobti 0 Reputation points
2025-01-22T15:52:39.4533333+00:00

Hi,
I am using the azure sponsorship subscription and would like to know the breakdown of costs consumed per resource or resource group. is that at all possible?

Azure Cost Management
Azure Cost Management
A Microsoft offering that enables tracking of cloud usage and expenditures for Azure and other cloud providers.
2,956 questions
Azure Startups
Azure Startups
Azure: A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.Startups: Companies that are in their initial stages of business and typically developing a business model and seeking financing.
540 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Abiola Akinbade 22,625 Reputation points
    2025-01-22T16:14:54.35+00:00

    Hello Joseph Kobti,

    Thanks for your question.

    Yes it is. Try the following:

    In the portal go to Cost Management + Billing and open Cost Analysis. From there you can select the Cost by resource option. This will display a breakdown of costs for each resource within your subscription.

    See: https://learn.microsoft.com/en-us/azure/cost-management-billing/costs/cost-analysis-common-uses

    You can mark it 'Accept Answer' and 'Upvote' if this helped you

    Regards,

    Abiola


  2. Ashok Gandhi Kotnana 2,810 Reputation points Microsoft Vendor
    2025-01-23T05:56:06.71+00:00

    Hi @joseph kobti ,

    Welcome to Microsoft Q&A Forum, thank you for posting your query here!

    To test this successfully, adjust the start and end times according to your requirements and run the process. The detailed step-by-step explanation is provided below.

    PowerShell Script below Just change start and end date It will give you cost for each resource.

    # Define the start and end dates for December 2024
    $startDate = "2025-01-01"
    $endDate = "2025-01-22"
    # Fetch cost details for the specified date range
    $costDetails = Get-AzConsumptionUsageDetail -StartDate $startDate -EndDate $endDate
    # Check for the available cost property
    if ($costDetails -and $costDetails[0].PSObject.Properties.Name -contains "CostInBillingCurrency") {
        $costProperty = "CostInBillingCurrency"
    } elseif ($costDetails[0].PSObject.Properties.Name -contains "PreTaxCost") {
        $costProperty = "PreTaxCost"
    } else {
        Write-Error "Unable to find a cost-related property in the returned data."
        return
    }
    # Calculate the total cost for the month
    $totalCost = ($costDetails | Measure-Object -Property $costProperty -Sum).Sum
    # Save details to a CSV
    $outputFile = "AzureCostDetails_December2024.csv"
    $costDetails | Export-Csv -Path $outputFile -NoTypeInformation
    # Display results
    Write-Host "Total cost for December 2024: $($totalCost.ToString("C"))"
    Write-Host "Cost details for December 2024 saved to $outputFile"
    

    Please find the below artifacts of the output: -

    $costDetails : Has cost of individual cost of the resources in your subscription

    User's image

    $totalCost contains total cost of the resourcesUser's image

    $outputFile = "AzureCostDetails_December2024.csv"

    Output will be stored in the AzureCostDetails_December2024.csv which will get downloaded as a csv Open the file you can see the total cost refer to column "PretaxCost Column" User's image

    Feel free to reach out if you have any further questions or need additional information—I’m happy to assist!

    Please provide your valuable comments User's image

    Please do not forget to "Accept the answer” and “upvote it” wherever the information provided helps you, this can be beneficial to other community members.it would be greatly appreciated and helpful to others.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.