Using LINQPad with Azure Table Storage

First, we need to load up LINQPad (I’m using V5) and creation a new connection. We will use the Azure Storage Driver for this.

2016-04-13_12-12-36

Then we will enter the required credentials in order to create the connection with our storage account.

2016-04-13_12-14-18

Once we’ve completed this process we can easily run C# expressions again our table using LINQ syntax. Let’s look at a few examples.

Viewing all entries:

2016-04-13_12-08-35

Viewing a specific entry by a simple where criteria:

2016-04-13_12-16-37

Now if we wanted to do something more complex, say delete all of the entries in a table or just a specific set of entries then we need to expand our process a bit. We can use the language type of “C# program” to build an actual C# program in LINQPad.

First, for this to work we need to add some DLL and Namespace references using the query properties.

Once we’ve added these references we can write a simple void Main() program and pretend like we are working with the table in C#.

In this example we are creating a storage account variable by using the CloudStorageAccount.Parse command to parse the connection string that Azure gives us.

Then we create a table client, pull in our table, and query it for all the entries with a specific partition key.

Finally, we run all the discovered queries through a loop and delete them.

Deleting an entry using a C# program layout:2016-04-13_12-09-02

Keep in mind this is a very simple example and does not take into account batches, continuation tokens, or any sort of API limits (of which there are a few you should be aware of).

Hope this helps get you started!

Advertisements

Power BI Desktop + SCSM 2012

I enjoy visualizing data. I believe it gives a different layer of insight to the data that we already have and bubbles up information we may have either felt like we knew already, or demonstrate to us something new entirely. It’s really a matter of bringing broad understanding to something that is otherwise foreign and nearly unusable.

For these exact reasons I’m really excited about the potential of Power BI and Power BI Desktop, but even more so the combination between the two.

Continue reading “Power BI Desktop + SCSM 2012”