

You have to be aware, that you only get the first 1000 Rows. Note: To prevent PowerShell to interpret $filter as a PowerShell variable, you have to escape the dollar sign like `$filter The script does an HTTP GET request on "$($StorageUri)/$($TableName)()?$SASToken&`$filter=$($Query)" Query the existing entitiesĪs first step, we need to get the existing items as we need the PartitionKey and RowKey for every item.īased on the Documentation, we can use the $filter option to return only entities that matches with this filter. The PowerShell function returns the number of deleted rows. Check out for more details.Įxample: "PartitionKey eq 'part1' and Timestamp ge datetime'T13:49:49.000Z' and Timestamp lt datetime'T13:49:49.000Z'" Return value Make sure you grant delete rights on the Azure Table. You can use "Azure Storage Explorer" or the Azure Portal to generate a SAS Token. SASToken is used to authenticate on the Storage Account.

TableName specifies the table you want to use SASToken StorageUri is the URL of your StorageAccount like TableName The PowerShell function requires some parameters: Remove-AzureTableEntities -SASToken "sv=&se=T13%3A38%3A38Z&sp=raud&sig=vCQ4%2Bg0rt5YGGI8bFGv5tW0o5s2KMl31NuXwIGjJ3vo%3D&tn=test" -StorageUri "" -TableName "TEST" -Query "PartitionKey eq 'lookup' and Timestamp ge datetime'T13:49:49.000Z' and Timestamp lt datetime'T13:49:49.000Z'" Make sure you have a Backup! and double check your queries !!! Example Note: Recovering data takes much more time than deleting.

This example Script provides a way to use " Entity Group Transactions" and " Paging" to speed things up. Deleting massive amounts of Azure table entities based on a query can be a time- consuming task.
