Search code examples
azureazure-storageazure-table-storageazure-virtual-machineazure-diagnostics

Automatically delete the old tables in Azure Storage via java sdk


We are using Azure Diagnostics extensions to publish performance metrics from Virtual Machine to the configured Azure Storage tables. https://learn.microsoft.com/en-us/azure/virtual-machines/extensions/diagnostics-linux#public-settings

These metrics are stored in tables, table name such as WADMetricsPT1MP10DV2S2017060

The table name is the concatenation of these strings:

WADMetrics The "scheduledTransferPeriod" for the aggregated values stored in the table P10DV2S A date, in the form "YYYYMMDD", which changes every 10 days Examples include WADMetricsPT1HP10DV2S20170410 and WADMetricsPT1MP10DV2S20170609.

Is there a way in Azure portal to automatically delete the old tables?


Solution

  • Is there a way in Azure portal to automatically delete the old tables?

    Unfortunately no. You will need to do it manually.

    You can however write some code and automate that code. What you have to do is list all the tables, extract the date part from the table name and decide if that table is old enough to be deleted and then delete it. Depending on how you want to do it, you can use Azure Automation, Azure Functions or Logic Apps to accomplish the automation bit.