Now it’s time to create the storage account and get the connecting string for our .Net Core app.
First create the storage account by logging in to Azure CLI and place it in the same Resource Group and your Event Hub.
az storage account create \
--resource-group storage-resource-group \
--location westus \
--sku Standard_RAGRS \
Next create the blob account. Go into Azure and select your new storage and create a blob container.
Finally copy the storage connection string for the storage account.
Now in the next post we’ll create our code and receive some Event Hub messages!
Following the Microsoft Docs quickstart let’s write some code from their instructions!
Add the using statements in the programs.cs file
Next go and get the namespace connection string and copy this so we can add the connection string to our code.
And inside the class add the constants and get the connection string and eventhub name from your event hub and copy them
private const string connectionString = "";
private const string eventHubName = "";
Finally replace the Main method with the method described in the link and build the project!
Now run the project and watch your three events being sent to your very own Azure Event Hub!
And inside your event hub you can now see the metrics updated.
Now in the next post we’ll create a storage and an app to receive the messages.
Launch Visual Studio 2019 and create a C# .Net Core console app.
Now this first app will be the sender app so note the project and of the solution.
Open the Nuget Package console and add the nuget package as such.
There we go! Now in the next post we’ll write the code and watch our Event Hub update in the portal!
Let’s write some code and work with Azure Event Hubs. You can check out more about it here and here to view all the pre-requisites.
First jump over to the portal to create an Event Hub namespace.
Next go to the Event Hub namespace and create an event hub.
There you go! Next time we’ll download and add the event hub packages in visual studio.