Topconf Talinn 2017

I’m currently in Talinn where I’m taking part in Topconf Talinn 2017. After a day of travelling and looking around in the city my talk was scheduled in the morning of the first day.

I presented my blockchain talk which I had slightly modified to fit it in the time slot of 40 minutes. This forced me to remove some parts but still it was difficult to get it done in the allotted time. Luckily I took part in the open space lab in the afternoon where a couple of attendees approached me to learn more about the subject. My talk currently has a rating of 4.6/5.

Slides can be downloaded here and the source of my Ethereum game is available on GitHub.

I haven’t applied this talk to any future conferences, so for now this is the last time I gave it. A recording of my session at NDC Oslo 2017 is also available on YouTube.

PowerBI with .NET Core

In May I integrated PowerBI in a .NET Core and Angular application. In June a new version of PowerBI was released with an entire new way of getting reports to your customers, so I had to do the exercise again. The C# SDK only supports the .NET framework so I used the PowerBI API directly to implement it. Although the API is documented I was only able to get it all working by reading it carefully and also following every step mentioned in this article. The end result is great, Power BI offers a great reporting solution, getting it to run however was not a walk in the park. You can read about different scenarios on the official website.

The ability to alter and publish reports without writing any code is awesome. In my current project we have an admin user that creates reports in PowerBI desktop, he uploads the report in our web application and we then publish it to each customer. They all have their own database and PowerBI allows you to basically change the connection string. In theory, it’s mentioned on the PowerBI site, we could also allow the customers to modify the published report or create their own. A scenario which we currently don’t need but which I might investigate nonetheless.

This weekend I decided to take a look again at the C# SDK. It’s really just a small layer between the API and your application and you don’t really need it, but it’s the natural place to start looking around. Since it only targets the .NET framework I couldn’t use it in .NET core. I forked the project, modified the csproj files to target .NET Standard 2.0 and updated the packages that were referenced. Zero warnings, zero errors. Not bad for a conversion!

The only thing that is different from the official samples is the way to get a token to call functions in the API. The official samples use UserPasswordCredentials which is not available. So as another Github user mentioned you need to do the heavy lifting yourself.

private async Task<TokenCredentials> GetAccessToken()
    using (HttpClient client = new HttpClient())
        string tenantId = "";
        var tokenEndpoint = "";
        var accept = "application/json";
        var userName = "";
        var password = "";
        var clientId = "";
        client.DefaultRequestHeaders.Add("Accept", accept);
        string postBody = null;
        postBody = $@"
        var tokenResult = await client.PostAsync(tokenEndpoint, new StringContent(postBody, Encoding.UTF8, "application/x-www-form-urlencoded"));
        var tokenData = await tokenResult.Content.ReadAsStringAsync();
        JObject parsedTokenData = JObject.Parse(tokenData);
        var token = parsedTokenData["access_token"].Value<string>();
        return new TokenCredentials(token, "Bearer");

Once you have the token you can use the SDK as is.

    var tokenCredentials = await GetAccessToken();
    using (var powerBiclient = new PowerBIClient(new Uri(""), tokenCredentials))
        var reports = powerBiclient.Groups.GetGroups();

I’ve pushed the code to GitHub and published it as a NuGet package.