Home » Archives for January 2017

Month: January 2017

Creating NuGet packages for C# libraries

A few weeks ago I published my first C# NuGet package. The package is a RSS and ATOM FeedReader library that I developed, because existing libraries had issues with encodings, different languages or others. In this blog post, I will quickly describe how to create a NuGet package for a C# library.

The first thing to do is to install nuget.exe. This can be done by downloading the nuget.exe from nuget.org or by using chocolatey. I already blogged about how to use chocolatey (Chocolatey – Package management for Windows) and we will reuse that for the nuget install.

Read more

Chocolatey – Package management for Windows

I already blogged about the package management module of the Powershell and how great and awesome it is (Powershell package management – NuGet, Chocolatey and Co). It just can happen, that the installation of some modules from chocolatey do not work as expected. I had this e.g. for Firefox or Chrome. In such cases, it’s better to directly use chocolatey (choco.exe).

Fastest way to install and run it is to open Powershell as administrator and execute the following script:

Set-ExecutionPolicy Unrestricted
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex

This installs chocolatey and adds it to the path. After that, you should be able to run chocolatey:

choco install firefox -x86
choco install notepadplusplus -x86 # 64 bit version does not have all plugins

Read more

Export Azure Usage data to CSV with C# and Billing API

The first important thing to mention is, that there are two types of the Azure billing API. One is the billing API for EA (enterprise agreement) customers. This API is easier to use, because it returns the costs in a separate field (extendedCosts). If you have an enterprise agreement, I recommend to check the following blog post: http://www.redbaronofazure.com/?p=631.

The other one is the billing API for non EA users (see Azure Billing REST API Reference. This API has two services, the RateCard API which returns costs for your resources (e.g. S1 DocumentDB costs per hour in region West Europe). I already blogged about how to export the RateCard data to CSV. In this post, I’ll focus on the second one which returns the usage data. This service returns the usage of your resources – e.g. “Standard IO – File Write Operation Units (in 10,000s), quantity: 3.182, …”. Unfortunately, the usage API does not return the costs per resource. If you want to know the costs, then you need to combine the RateCard data with the Usage data.

Update February 7, 2017: I built a .net library and published it as NuGet package which you can use to get data from the usage api and the ratecard api. The library also combines the usage and ratecard data and calculates the costs. The code is published on GitHub and I blogged about the usage and the configuration of it:

This blog post is still valid, it shows the how to configure and build an application that uses the Azure Billing Usage REST API.

Read more