DEV Community

Paweł Ruciński
Paweł Ruciński

Posted on

Seed Table Storage

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

Top comments (3)

Collapse
 
gregadze profile image
greg-adze

Thanks for the very useful devops task. I noticed that we are getting a warning now, do you have any intention of updating this task?

[warning]Task 'SeedTableStorage' (1.2.1) is using deprecated task execution handler. The task should use the supported task-lib: aka.ms/tasklib

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

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