Skip to content

feat: server_auth with Microsoft Workload Identity #906

Merged
levkk merged 18 commits intopgdogdev:mainfrom
MagicAbdel:main
Apr 17, 2026
Merged

feat: server_auth with Microsoft Workload Identity #906
levkk merged 18 commits intopgdogdev:mainfrom
MagicAbdel:main

Conversation

@MagicAbdel
Copy link
Copy Markdown
Contributor

This PR adds support for Microsoft Workload Identity for server authentication on a per-user basis, following the existing pattern used for rds_iam.

Changes:

  • Implemented token acquisition logic for Azure Entra ID.
  • Ensured parity with the rds_iam implementation for

This is my first contribution in Rust! 🦀
I’ve done my best to follow the existing patterns in the codebase, but I'm still learning the nuances of the language. Please be indulgent. If there are more idiomatic ways to handle the logic, async calls, or error handling, I am very happy to make changes based on your feedback!

Note: I also created a PR on the helm chart (here) to allow users to add azure.workload.identity/use: "true" label to the pod for injecting workload Identity.

Here are some logs I tested this solution in AKS with Workload Identity directly injected into the pod:
image

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 16, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Collaborator

@levkk levkk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 👍 🙏 🚀

@levkk
Copy link
Copy Markdown
Collaborator

levkk commented Apr 16, 2026

rand has been an issue for a while. Every time a new crate is added that uses a different version than what we have, we get this conflict. Let me see if I can resolve it.

@levkk
Copy link
Copy Markdown
Collaborator

levkk commented Apr 16, 2026

Apply this diff when you get a second:

diff --git a/pgdog-config/src/util.rs b/pgdog-config/src/util.rs
index 64c10341..6e39d55d 100644
--- a/pgdog-config/src/util.rs
+++ b/pgdog-config/src/util.rs
@@ -1,6 +1,6 @@
 use std::time::Duration;
 
-use rand::{distr::Alphanumeric, Rng};
+use rand::{distr::Alphanumeric, RngExt};
 
 pub fn human_duration_optional(duration: Option<Duration>) -> String {
     if let Some(duration) = duration {

@MagicAbdel
Copy link
Copy Markdown
Contributor Author

Applied the diff and verified with cargo check. The rand conflict seems resolved now. Thanks for the help with that

Comment thread pgdog/src/backend/schema/sync/pg_dump.rs
@levkk
Copy link
Copy Markdown
Collaborator

levkk commented Apr 16, 2026

You should be able to run tests locally:

  1. bash integration/setup.sh
  2. cd pgdog && cargo nextest run --test-threads=1 <name of your test function>

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 72.97297% with 60 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pgdog/src/backend/auth/azure_workload_identity.rs 15.71% 59 Missing ⚠️
pgdog/src/backend/server.rs 97.82% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@levkk
Copy link
Copy Markdown
Collaborator

levkk commented Apr 16, 2026

Kind of a bad day for our CI. I'll take a look at this later tonight / tomorrow to figure out what's going on. The code looks good, just getting the tests to pass now.

@levkk levkk merged commit d981e13 into pgdogdev:main Apr 17, 2026
13 of 17 checks passed
levkk added a commit that referenced this pull request Apr 17, 2026
New crate versions in #906 require later compiler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants