DEV Community

loading...

Seed Table Storage

meanin profile image Paweł Ruciński ・2 min read

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

img

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:
img

This is the first published version of this task. I will appreciate all feedback :)

Discussion

pic
Editor guide
Collapse
devmonte profile image
Grzegorz Jońca

I will appreciate more info about the extension that you mentioned. Maybe some description or photo? :)

Collapse
meanin profile image
Paweł Ruciński Author

I am not sure, what you are asking for? All capabilities of the extension are described here or here.

All of the tasks included in the extension are my authorship. If you have any more questions, or change requests shout please :)