Secret Retrieval using Dapr

Let’s start with “What is Dapr?”. Taken from the site: “Dapr helps developers build event-driven, resilient distributed applications. Whether on-premises, in the cloud, or on an edge device, Dapr helps you tackle the challenges that come with building microservices and keeps your code platform agnostic.” It has many different components that help in this endeavor. This post is focused specifically on secrets, and more specifically, retrieving them.

The Dapr .NET SDK currently supports three different methods for secret retrieval from an app (other SDK’s are probably similar but I haven’t looked into those):

  1. HTTP (ok, technically this isn’t using the Dapr .NET SDK)
  2. Using the DaprClient
  3. Using the configuration provider

That last option is nice because you end up with your Dapr secrets injected into your apps configuration system and secrets can be access through an IConfiguration object.

While there are samples around that cover those methods, I found them scattered around various repos and websites. I wrote a basic sample to demonstrate all three methods in a single repo that I published here.

Leave a Reply

Your email address will not be published.