[azure-ai-ml] Support Key Vault secret injection into environment variables for scheduled command and pipeline jobs

未关闭
#49,950 3 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
azure, python
领域
cloud

调研方向

Start by reading the Azure ML job configuration and environment_variables handling for YAML/CLI and the Python SDK, then check how online deployment secret injection is represented. The requested behavior requires service-side runtime identity, scheduled-run resolution, versioned and latest secret references, and safeguards for persisted definitions and logs. Done means command and pipeline jobs support the described Key Vault syntax through both interfaces and fail without exposing secret values.

由索引模型根据 Issue 内容生成。

描述

Client customer-reported Machine Learning needs-team-attention question Service Attention

Is your feature request related to a problem? Please describe.

I run multiple scheduled Azure Machine Learning jobs, each using different credentials stored in Azure Key Vault. I want the application code to consume consistent environment variable names, while each job’s configuration maps those names to the appropriate Key Vault secrets.

Currently, this requires custom code to retrieve secrets and populate environment variables at runtime. This adds Azure-specific secret retrieval logic and dependencies to jobs that would otherwise only need to read environment variables.

Azure ML online deployments already support declarative secret injection. I would like equivalent functionality for command and pipeline jobs, including scheduled runs.

Describe the solution you'd like

Support Key Vault secret references in a job’s environment_variables configuration, using syntax consistent with online deployments. For example:

environment_variables:
  DATABASE_USERNAME: ${{keyvault:https://my-vault.vault.azure.net/secrets/job-a-db-user}}
  DATABASE_PASSWORD: ${{keyvault:https://my-vault.vault.azure.net/secrets/job-a-db-password}}

The service should:

  • Resolve references at the start of each run, including scheduled runs, using the job’s configured runtime identity.
  • Support versioned references and versionless references that retrieve the latest secret version.
  • Inject the resolved values into the job container before the application starts.
  • Keep secret values out of persisted job definitions and service-generated logs.
  • Fail with a clear error if a secret cannot be retrieved, without exposing its value.

This should work consistently through YAML/CLI and the Python SDK.

Describe alternatives you've considered

  • Retrieve secrets inside each application: Works, but couples application code to Azure Key Vault and duplicates retrieval logic across jobs.
  • Use a shared startup wrapper: The wrapper reads a mapping configuration, retrieves secrets, sets environment variables, and launches the application. This preserves a consistent application interface but requires maintaining custom infrastructure code.
  • Retrieve secrets before submitting the job: This places resolved values in the submitted configuration and does not allow an existing schedule to retrieve rotated secrets automatically on each run.

Additional context

The intended use case is to reuse the same application or container across multiple scheduled jobs. For example, every job reads DATABASE_PASSWORD, while each job maps that variable to a different Key Vault secret.

This is a request for service-side secret injection at runtime, extending the capability already documented for online deployments:

Access secrets from online deployments using secret injection

主要语言
Python
星标
5.6k
派生
3.4k
平均合并
1 天 22 小时
30 天内合并 PR
189

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Azure/azure-sdk-for-python 的其他 Issue

查看 Azure/azure-sdk-for-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。