- Inserting Records -Understanding Table Storage - Part Two
- Retrieving Records -Understanding Table Storage - Part Three
- Updating Records -Understanding Table Storage - Part Four
- Batch Table Operations-Understanding Table Storage - Part Five
- Deleting Records -Understanding Table Storage - Part Six
When you create a storage account, it includes the Table service alongside the Blob and Queue services. Table services can be accessed through a URL format. It looks like this:
- Storing TBs of structured data capable of serving web-scale applications
- Storing datasets that don't require complex joins, foreign keys, or stored procedures and can be denormalized for fast access
- Quickly querying data using a clustered index
- Accessing data using the OData protocol and LINQ queries with WCF Data Service .NET Libraries
Here in this article first we will create a storage account and have the keys to use it in our application and then a console application, which connects to the storage account and create a table inside it.
Step 1
Log in to your Microsoft Azure portal, click on "Create new resource" and select "Storage account - blob, file, table, queue" from Storage category to create a Storage account and give the necessary details as follows.
- Name: A Unique Name
- Deployment: Resource manager
- Account kind: General purpose (Can’t work with Files, Tables or Queues in case of Blob Storage)
- Location: Nearest to you
- Replication: Read-access geo-redundant storage
- Locally-redundant storage- Three copies within the same data center
- Zone-redundant storage- Three copies within two data centers of the same region
- Geo-redundant storage- Three copies in a primary data center and three copies in another data center
- Performance: Standard (For premium only LRS replication is available as of now)
- Secure Transfer Required: Disabled
- Resource group: Create a new as TableStorageRG

Step 2

Create a new C# Console Application within Visual Studio and name it as TableDemo.

Step 4
Once the project is created, install two NuGet Packages named WindowsAzure.Storage and WindowsAzure.ConfigurationManager to your solution. You can do this by selecting Tools > NuGet Package Manager > Manage NuGet Packages for Solution. In the Browse tab search for WindowsAzure.Storage and WindowsAzure.ConfigurationManager to get the packages complete the installation by reviewing the changes and accepting the license term for both.


Step 5
Now we have to add the Connection String to the storage account. For that open the App.config file and add following code snippet within the configuration. Replace the [Connection string] with the connection string value you copied in Step 2.
- <appSettings>
- <add key="StorageConnection" value="[Connection String]" />
- </appSettings>

Step 6
Now, go to the Program.cs Page and add the following code to the Main method. This code will create a connection with the storage account and create a table named images in our blob storage with a Public (Blob) access type.
- //Reference to the ConnectionString in the App.Config file
- CloudStorageAccount storageAccount = CloudStorageAccount.Parse(
- CloudConfigurationManager.GetSetting("StorageConnection"));
- CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
- CloudTable table = tableClient.GetTableReference("customers");
- table.CreateIfNotExists();
- Console.ReadKey();
Add the following namespaces also
- using Microsoft.Azure;
- using Microsoft.WindowsAzure.Storage;
- using Microsoft.WindowsAzure.Storage.Table;

Step 7
Click on Start to run the program and you will see a console window waiting for an input as we given Console.Readkey() at the end of the code.

Go back to your storage account and select Table service from the overview tab and you can see that we now have a customers table there (Refresh if not reflected).



Hadshana KamalanathanPosted Jul 14, 2018, 11:45 PM
Thank you for sharing...