Seed Table Storage
Paweł Ruciński
Posted on November 13, 2018
Introduction
I wrote a few sentences about an Azure Cloud here. When you are deploying an application, sometimes you need some basics data already be placed in a database. Some prerequisites, without which an application will work in a wrong manner. Seeding and migrating SQL databases in a .net world is a well-described topic. If you know Entity Framework or Hibernate, you know where to start. What to do with this, when you want to store data in an Azure Table Storage?
Install extension
To install this extension, you need an organization on Azure DevOps portal. You can start here. On this portal, you have to have rights to install extensions. Then navigate here.
Configure task
To use this task you have to have a configured Azure Resource Manager connection with a Service Principal. Set a storage account name and a table name which you want to seed. Select a JSON file location. The file has to be a JArray of a flat object, which everyone contains at least two properties: PrimaryKey and RowKey.
Here is a little example:
[
{
"partitionKey": "partitionKey1",
"rowKey": "1",
"otherColumn": "value1",
"fourthColumn": "123"
},
{
"partitionKey": "partitionKey1",
"rowKey": "2",
"otherColumn": "value2",
"fourthColumn": "123"
},
{
"partitionKey": "partitionKey2",
"rowKey": "1",
"otherColumn": "value1"
},
{
"partitionKey": "partitionKey2",
"rowKey": "2",
"otherColumn": "value1"
}
]
After release, table with data looks like below:
This is the first published version of this task. I will appreciate all feedback :)
Posted on November 13, 2018
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.