Search code examples
powershellazureazure-storageazure-table-storage

Delete tables from azure storage account older than 3 months with PowerShell


My company has an application that creates 2 tables each day in an Azure storage account with a Name format of mm/dd. We only need to store 90 days worth.

I am trying to find a way to delete the tables from the Azure storage account that are older than 3 months.

From what I can see the only attributes the tables themselves have are Name and Uri.

Does anyone know of a way to find the timestamp of when the table itself was created, not just an entity within it?


Solution

  • You'll need to store this table-creation-date metadata yourself, to query later (whether in another Azure Table or anywhere else). And then come up with some type of periodic scanning of this metadata to look for creation dates > 90 days. And how you accomplish this is really up to you - lots of options...

    Also: Unlike Blobs, Tables don't have associated metadata properties, so you cannot store this metadata directly attached to a Table.