Catch our previous article on Azure cloud services here.
This article will cover the basics of design and implementation of storage (tables and blobs) and Azure SQL databases. We will also touch upon services using the REST API.
For data storage, you need a SQL management system and data providing service
To start with, Microsoft Azure provides us two storage options: Azure Storage and Azure SQL database
Azure Table storage is a NOSQL key value store which provides the ability to store non-relational data and structured data without any schemas – thus the application data models aren’t necessarily locked down to a set of schemas. It is not a relational data store and does not provide the same relational data management functions as Azure SQL Database does (joins, stored procedures etc.). It is more useful for high volume databases, geographically distributed databases etc.
Azure SQL Database
Azure SQL Database is a relational database management system based on the SQL Server engine and built on standard relational principles and practices. As such, it provides relational data management capabilities through Transact-SQL queries, ACID transactions, and stored procedures that are executed on the server side. SQL Database is more suitable when the application requires data sets with relationships, integrity, referential constraints, and data volume not exceeding 150 GB.
To use Azure Storage, the user will need to create an Azure Storage Account. The account provides us with three services - Table, Blob and Queue. Before moving on to creating an Azure Storage Account, let’s talk about Table Storage and Blob Storage in brief.
Azure Table Storage
Azure Table Storage stores large amounts of non-relational structured data. Due to its unstructured nature (schema-less) it enables us to store and retrieve simple relational data efficiently. Additionally, different rows within the same table can have different structures in Azure Table Storage.
Azure Blob Storage
Azure Blob (Binary Large Objects) storage stores large amounts of unstructured binary and text data. It provides persistent data storage which is perfect for users of the PaaS system – Cloud Services – because the hard drives used in cloud server instances themselves are not persistent.
Creating an Azure Storage Account
(These instructions are only valid if the user already has a Microsoft Azure account. Click here to find out how to get an account)
Login to the Windows Azure management portal, and then click Storage.
Then click on Quick Create and fill in the required credentials. The URL through which the user wants to access the Azure Storage account is entered in the first box. In the second box, the name should be unique (globally for all users) and all must be entered in lower cases. The closest area in terms of proximity needs to be filled in, and then the kind of subscription. The replication option is primarily to replicate the database for availability and durability.
The storage account should now be created successfully with the status saying that it is Online.
If you scroll down the same page, you can notice three different endpoints are listed – Blobs, Tables, and Queues. They are all created by default while creating the storage. As already mentioned, this article will focus more on Tables and Blobs.
And that's all it takes to set up a Azure Storage Account!
Azure Table Storage Implementation
Table storage doesn’t enforce schema and that means entities with different properties can be contained in the same table - it could be viewed as a container for a collection of entities with properties. An entity is similar to a database row and it has size limitation of 1 MB, and each property is a name-value pair and has its own size restrictions. Each entity must have three properties: a partition key, a row key and a timestamp
This should be made further clear with this example. In the figure above, Library Catalogue is the Table, Books and DVD are the entities, and Title, Author, etc. are the key-value pair properties. The tables can be physically partitioned for load balancing and stability – for instance, Books and DVD can be partitioned using LINQ queries, and we would be able to search either only in Books or DVD instead of scanning the entire table. The query for looking for a book with a particular title would look something like:
REST API to use Table Service
The REST API for Table service provides operations to manage the table and the date it contains. In this section, we will look at some basic operations.
As a pre-requisite, the user needs to create connection strings to the services using the Azure cloud service.
1) Namespaces to Use:
2) Creating a Table
3) Creating an Entity
4) Insert Operation on Table
Azure Blob Storage Implementation
Blob storage is similar to Table storage in the sense that it has containers and blobs. A container is a set of blobs, and a Blob can store any type of file and have various sizes (Block and Page blobs). All file blobs (with 200 GB size limitation) are block blobs.
Over here Books, Audio books, Movies are containers and the myBook.pdf, myAudiofile.wav and myMovie.avi files are block blobs.
REST API to use Blob Service
The REST API for the Blob service defines HTTP operations against container and blob resources. With these operations we can manage them programmatically. In this section, we will look at basic operations.
As a pre-requisite, the user will need to create connection strings to the services using the Azure cloud service.
1) Namespaces to Use
2) Create a Container
3) Upload the Blob
To conclude with, this article described Azure Storage Accounts, Tables and Blob services in brief. It also covered code samples to use the table and blob REST services and its operations.
The next article in this series would cover Microsoft Azure’s media service offerings. Give it a read here.
Other Popular Deals
- 10 websites and applications you must know about8 music streaming services worth trying out
- 6 ways to start learning Microsoft AzureHow to improve your Firefox browsing experience
- The 12 most hilarious YouTube channels10 Microsoft Big Data Success Stories
- 15 must have chrome extensions15 apps and websites to accomplish everyday tasks
- 10 YouTube sci-tech channels every geek should follow10 reasons to trust Azure with your data