How can we fetch the cost and Last Modified date and time of a whole storage account?

Chintakindi, Anogna 20 Reputation points
2023-06-14T11:15:09.97+00:00

Hi there,

I want to calculate the cost of a whole storage account in a specific subscription.

And want to check the last updated or modified date\time of a storage account itself. So that we can plan the storage account life cycle and Cost optimization by filtering out which storage accounts are not in use.

--> Is it possible to fetch the Last modified date\time for storage account similar to creation time format?

-->And find out the cost of all storage accounts including all factors accurately?

Hope I can get the solution for my both queries soon.

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,524 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tulika Priyadarshini 165 Reputation points Microsoft Employee
    2023-06-14T16:55:25.64+00:00

    Azure Storage Accounts have lifecycle management policies which help with following:

    • Transition blobs from cool to hot
    • Transition blobs, blob versions, and blob snapshots to a cooler storage tier if these objects have not been accessed or modified for a period, to optimize for cost. The objects can be moved from hot to cool, from hot to archive, or from cool to archive.
    • Delete blobs, blob versions, and blob snapshots at the end of their lifecycles.
    • Apply rules to containers or to a subset of blobs, using name prefixes or blob index tags as filters. 

    Example of a rule could be: 

    • Any files where the modified date is older than 90 days will be changed to the Cool tier. 
    • Any files where the modified date is older than 180 days will be changed to the Archive tier. 
    • Delete files older than 365 days. 

    If the condition to move a blob is based on last accessed time you need to enable last access time tracking https://learn.microsoft.com/en-us/azure/templates/microsoft.storage/2021-02-01/storageaccounts/blobservices?tabs=json&pivots=deployment-language-terraform 

    The rules translate to a JSON format. So once you create the rule through the portal get the JSON from the code view and you can use PowerShell/Terraform(https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_management_policy) to apply to other storage accounts.

     User's image

     

    For optimising current storage accounts, you can run PowerShell or use Terraform to update the policies.

    For governance purposes any new storage accounts being created should have these policies enabled (https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/storage_management_policy)

    Useful links:

    https://learn.microsoft.com/en-us/azure/storage/blobs/lifecycle-management-policy-configure?tabs=azure-portal

    https://learn.microsoft.com/en-us/azure/storage/blobs/lifecycle-management-overview 

    Please do let me know if this makes sense for your scenario or any additional questions you might have.

    0 comments No comments

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.