How to delete an entire Azure Table in one command

Deleting an Entire Azure Table

  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











// Retrieve storage account from connection string

CloudStorageAccount storageAccount = CloudStorageAccount.Parse(



// Create the table client

CloudTableClient tableClient = storageAccount.CreateCloudTableClient();


// Delete the table it if exists



Hope this helps.

Comments (3)

  1. Gaurav Mantri says:

    One thing I would like to point out is that this operation will actually start deletion operation. Windows Azure Storage service would mark this table as "To Be Deleted" (or something like it) so that any attempt to access this table (like read/write etc.) will throw an error. However the actual deletion process could take a lot of time depending on the number of entities you have in that table. While the table "is being deleted" any attempt to recreate the table will result in an error.

  2. zhaspe says:

    actually I have a azure table with about 1~2 million records.

    I've tried several times to delete the table but got 500 error.

    I don't know whether there is any other better idea to delete one azure table.


    [send me your code at]

  3. Robert Dytmire says:

    The trick for quick clearing is simple.  Keep a shortcut to your container hosting the table in your API's.  Then, use the shortcut for reference / looking up container name during runtime.  That is, the table name is virtual and referenced by a shortcut in your code.

    When you want to clear a container (table) just change your shortcut to reference a different container and then clear the old one.   Swap back and forth between containers.  INSTANT clear with no downtime!  

    Since your API's will be referencing a shortcut the underlying table will be swapped out on the fly, but your code won't know it happened.   Now Microsoft can take as long as it wants to clear the old table.

    Of course, you'll need to keep a set of round-robin containers and possible storage accounts for this, but you DID keep everything abstracted right?