Forum Discussion

Oleg_A's avatar
Oleg_A
Copper Contributor
Aug 25, 2024
Solved

Fin All new Resources and ideally their cost

Hello:

 

I wonder if there is a way to find out ALL Resources in our tenant that were created since specific date (like last 7 days) and their cost for the same period. 

Ideally I'd like to run it via PowerShell... 

How can I do it?

 

We are not enforcing "create date" tags...

 

Thank you!

  • To get a list of all resources created within a specific date range (like the last 7 days) and their associated costs, you can use a combination of Azure PowerShell and the Cost Management API. Since you aren’t using tags for creation dates, you’ll need to query resource metadata to approximate the creation date
    Step 1: Retrieve Resources Created Within a Specific Date Range
    Azure doesn’t store the creation date directly, but you can approximate it by using the CreatedTime property, which can be retrieved from resource activity logs.
    Step 2: Retrieve Costs for the Identified Resources
    Once you have the resource IDs, you can use the Cost Management API to pull the associated costs.

2 Replies

  • sachinagrawal's avatar
    sachinagrawal
    Copper Contributor
    To get a list of all resources created within a specific date range (like the last 7 days) and their associated costs, you can use a combination of Azure PowerShell and the Cost Management API. Since you aren’t using tags for creation dates, you’ll need to query resource metadata to approximate the creation date
    Step 1: Retrieve Resources Created Within a Specific Date Range
    Azure doesn’t store the creation date directly, but you can approximate it by using the CreatedTime property, which can be retrieved from resource activity logs.
    Step 2: Retrieve Costs for the Identified Resources
    Once you have the resource IDs, you can use the Cost Management API to pull the associated costs.

Resources