Forum Discussion
Oleg_A
Aug 25, 2024Copper Contributor
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...
- Aug 26, 2024To 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.
sachinagrawal
Aug 26, 2024Copper 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.
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.
Oleg_A
Aug 26, 2024Copper Contributor
sachinagrawal ,
Yes, Thanks a lot for the idea!!!
It worked just fine.
Some code could be found here: https://techcommunity.microsoft.com/t5/azure/list-all-new-resources-created-within-a-week/m-p/4228218#M17230
Yes, Thanks a lot for the idea!!!
It worked just fine.
Some code could be found here: https://techcommunity.microsoft.com/t5/azure/list-all-new-resources-created-within-a-week/m-p/4228218#M17230