question

John-6921 avatar image
0 Votes"
John-6921 asked shivapatpi-MSFT answered

Storage account information

I require information on all of our storage accounts, currently we have over 300 and have reached our quota in weu. I need to find out which storage accounts are not being used, and what data if any is held within these storage accounts. Ideally when they were last used, for instacen maybe not accessed in the last 90 days. I don't wish to manually go through these as that's time consuming. We also don't have logging available so am unable to utilise the monitoring aspect of things. Is there a script available that I could use? Many Thanks John

azure-storage-accounts
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

shivapatpi-MSFT avatar image
0 Votes"
shivapatpi-MSFT answered

Hello @John-6921 ,
Thanks for your query !
Can you try out the script mentioned here in the article

Below piece of code validates and removes based upon the last modified date of the container

Below code goes one level deep i.e. along with container it also checks for the last modified date of the blob.

Based upon your requirements you can use either of those.

Before you run the code , I would suggest to comment the command "Remove-AzStorageAccount" and just do a write-host $StorageAccountName,$LastModified just for review and do a sample test from your end.

Couple of best practices:
Before you remove the storage account , try to enable "Soft Delete" feature set it for X number of days. So this way your data can be retained for those number of days
Also , you can recover the storage account if you feel the account was deleted unexpectedly . Use the article below
https://docs.microsoft.com/en-us/azure/storage/common/storage-account-recover#:~:text=To%20recover%20a%20deleted%20storage%20account%20from%20within,the%20Recover%20button%20to%20restore%20the%20account.


Happy Scripting and all the very best !

If the above answers helps you out , kindly don't forget to Upvote and Accept the Answer





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.