Azure Event Hubs from WinRT/UWP Apps

Just a small thing that caught me out the other day. I wanted to send some simple data from a Windows 10 UWP app to an event hub in Azure.

There’s a great guide to getting started with event hubs here;

Getting Started with Event Hubs

which worked really well for me up until the section ‘Send messages to Event Hubs’ which has a step 3 which asks you to install the NuGet package WindowsAzure.ServiceBus.

Now, in the tutorial I think that’s all fine because it’s a console application that’s being built on top of .NET Framework.

However, Windows Store/Phone apps and UWP apps are all on .NET Core, not .NET Framework and when I try and install that NuGet package I get;


which seems to be saying that the package Microsoft.WindowsAzure.ConfigurationManager isn’t compatible with .NET Core.

I did a bit of a web search and came across a bug report on this;

Microsoft.WindowsAzure.ConfigurationManager doesn’t support Windows 8.1

and it looks like this has been closed off as ‘by design’ so I’m not sure at the time of writing what the recommended way of using event hubs from a Windows Store or UWP app is meant to be.

Naturally, a UWP app might be running on an IoT device like a Raspberry Pi 2 powered by Windows 10 for IoT Core which would be a scenario where you may well want to use an event hub for gathering data so I was a bit disappointed not to be able to use this package because it contains the EventHubClient class which makes it pretty easy to publish data to an event hub but I asked around a little and ended up using the package ampqnetlite instead and switching to AMQP protocol to get the data to my event hub.

So…just a note if you find yourself in the same situation and I’ll update the post if I find that there’s a way of getting that EventHubClient class to be a part of a UWP app, it’s possible that it’s just an awareness thing on my part.