Platinum Partner
architects,cloud,tips and tricks,infrastructure,azure

How to Delete an Entire Azure Table in One Command


001

  1. How to delete an entire Azure table is quite easy.
  2. I get this question quite often. I normally would not create such a simple post.
    1. Most developers think they need to delete rows, one row at a time.
    2. But that isn't true.
  3. There is support for deleting a whole table.
  4. Here is the REST-based approach
  5. Here is the approach using the .NET libraries

Sample.cs 

// Retrieve storage account from connection string
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
    CloudConfigurationManager.GetSetting("StorageConnectionString"));
  
// Create the table client
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
  
// Delete the table it if exists
tableClient.DeleteTableIfExist("people");


Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}