PrithviBadiga commented on code in PR #65692:
URL: https://github.com/apache/airflow/pull/65692#discussion_r3133019862


##########
providers/microsoft/azure/src/airflow/providers/microsoft/azure/secrets/key_vault.py:
##########
@@ -200,17 +207,41 @@ def build_path(path_prefix: str, secret_id: str, sep: str 
= "-") -> str:
             path = f"{path_prefix}{sep}{secret_id}"
         return path.replace("_", sep)
 
-    def _get_secret(self, path_prefix: str, secret_id: str) -> str | None:
+    def _build_team_secret_name(self, path_prefix: str, team_name: str, 
secret_id: str) -> str:
+        """Build a team-scoped secret name using a dedicated separator before 
the secret id."""
+        team_prefix = self.build_path(path_prefix, team_name, self.sep)
+        normalized_secret_id = secret_id.replace("_", self.sep)
+        return f"{team_prefix}{self.TEAM_SEP}{normalized_secret_id}"
+
+    def _is_team_specific_accessed_as_global(self, secret_id: str, team_name: 
str | None = None) -> bool:
+        normalized_secret_id = secret_id.replace("_", self.sep)
+        team_pattern = 
rf"[^{re.escape(self.sep)}]+{re.escape(self.TEAM_SEP)}.+"
+        return team_name is None and bool(re.fullmatch(team_pattern, 
normalized_secret_id))
+
+    def _get_secret(self, path_prefix: str, secret_id: str, team_name: str | 
None = None) -> str | None:
         """
         Get an Azure Key Vault secret value.
 
         :param path_prefix: Prefix for the Path to get Secret
         :param secret_id: Secret Key
         """
+        if team_name:
+            team_secret = self._get_secret_value(
+                path_prefix, self._build_team_secret_name("", team_name, 
secret_id)

Review Comment:
   Good catch, yes. My bad!
   I fixed the team lookup so it preserves `path_prefix`, and I added a 
regression test covering team lookup with a custom prefix.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to