How to use Azurite for testing Azure Storage in dotnet?

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • mkcert

    A simple zero-config tool to make locally trusted development certificates with any names you'd like.

  • Unfortunately, adding a certificate to the trust store requires a password prompt. On an Azure-hosted agent, this does not work and causes the agent to be stuck. To me, this could mean one of two things. Either the Azure team does not test over HTTPS, or they have a different set of test tooling. As it turns out, they have a set of helpers to construct the service clients and disable SSL verification. Like this:

  • azure-sdk-for-net

    This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.

  • The testing helpers have more to it than disabling SSL but are not present on NuGet. So naturally, I raised an issue to the SDK team if they have any plans in that direction. Unfortunately, at this point, they have no interest in releasing their internal test tooling. The techniques I mentioned thus far can be used standalone. I, however, felt this was an excellent opportunity to create my first NuGet Package. The package cannot assume how anybody runs Azurite, so I introduced two classes. You can use AzuriteAccountBuilder to configure how things are run, like the account or the ports being used. The AzuriteAccount class provides access to stuff like the connection string. For convenience the package also creates helper methods to create BlobServiceClient, TableServiceClient or QueueServiceClient form an AzuriteAccount.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • Kaylumah.Testing.Azurite

    Enable testing for Azure SDK dotnet using the Azurite Emulator

  • Usually, this is where I post a link to the posts GitHub repo. This time, the source code is the NuGet package on this GitHub Repo. In the post itself, I focussed on NPM; if you are looking for how to integrate with Docker containers, you can find an example test in the GitHub repo As always, if you have any questions, feel free to reach out. Do you have suggestions or alternatives? I would love to hear about them. Especially since this is my first NuGet package let me know if it helped you out.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts