Skip to content

Add workspace Key Vault secrets retrieval API for workspace services and user resources - #5021

Draft
Marcus Robinson (marrobi) with Copilot wants to merge 9 commits into
mainfrom
copilot/marrobicopilotupdate-from-main-fix-conflicts
Draft

Add workspace Key Vault secrets retrieval API for workspace services and user resources#5021
Marcus Robinson (marrobi) with Copilot wants to merge 9 commits into
mainfrom
copilot/marrobicopilotupdate-from-main-fix-conflicts

Conversation

Copilot AI commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Resolves #2402

What is being addressed

Researchers need to access secrets that resources place in the workspace Key Vault (e.g. VM credentials, storage account keys, database connection strings). Previously there was no way to retrieve these values through the API — resources could only surface an opaque Key Vault reference.

How is this addressed

Adopts the convention that any resource property whose name contains keyvault_secret_id holds a Key Vault secret identifier (the full secret URI). New endpoints resolve that reference to the underlying value on demand.

  • API endpoints (api_app/api/routes/workspaces.py):
    • GET /workspaces/{workspace_id}/workspace-services/{service_id}/secrets/{secret_name}
    • GET /workspaces/{workspace_id}/workspace-services/{service_id}/user-resources/{resource_id}/secrets/{secret_name}
    • secret_name is the property key. Requests are rejected with 400 if the property is not a secret reference, and 404 if the property or secret is absent. The user-resource endpoint keeps the existing owner/researcher ownership check.
  • Secret retrieval (services/secrets.py): async SecretClient fetch, parsing vault + name from the stored identifier. Retrieval is constrained to the workspace's own Key Vault (keyvault_uri) as defence-in-depth against cross-workspace access; failures surface as a typed SecretRetrievalError.
  • Base workspace template (templates/workspaces/base): grants the API managed identity Key Vault Secrets User on the workspace Key Vault and outputs keyvault_uri as a property.
  • Adds azure-keyvault-secrets dependency and SecretInResponse schema.

Only the Key Vault reference is stored in resource properties; the secret value is fetched on demand and is not persisted or masked in standard resource responses.

The UI "reveal secret" affordance described in the issue is out of scope here (API and below only).

  • Documentation: added the keyvault_secret_id convention to docs/tre-workspace-authors/authoring-workspace-templates.md.
  • CHANGELOG.md updated.
  • Versions incremented: API 0.26.00.27.0, tre-workspace-base 2.10.02.11.0.

Copilot AI requested review from Copilot and removed request for Copilot August 1, 2026 16:33
Copilot AI requested review from Copilot and removed request for Copilot August 1, 2026 16:34
Copilot AI changed the title [WIP] Add access to Azure blob storage for researchers Add workspace Key Vault secrets retrieval API for workspace services and user resources Aug 1, 2026
Copilot AI requested review from Copilot and removed request for Copilot August 1, 2026 21:18
@jonnyry

Copy link
Copy Markdown
Collaborator

Should the general direction be moving away from secrets - e.g. AAD authentication for databases and storage accounts?
Are the VM credentials necessary?

@marrobi

Copy link
Copy Markdown
Member

Should the general direction be moving away from secrets - e.g. AAD authentication for databases and storage accounts? Are the VM credentials necessary?

Great question. Agree should be moving to AAD/Entra. I was trying something, and didn't mean to open a PR. I was looking if we can have a single central Guacamole service, they key blocker is a shared service needs to retrieve the workspace VM passwords/secrets. I'm not sure is a way around this with Linux VMs? Also if a machine locks, no way to unlock without the password.

Also we have scenarios where AI model auth is via API key. But completely agree Entra auth should be the default.

Welcome thoughts.

@jonnyry

Copy link
Copy Markdown
Collaborator

Should the general direction be moving away from secrets - e.g. AAD authentication for databases and storage accounts? Are the VM credentials necessary?

Great question. Agree should be moving to AAD/Entra. I was trying something, and didn't mean to open a PR. I was looking if we can have a single central Guacamole service, they key blocker is a shared service needs to retrieve the workspace VM passwords/secrets. I'm not sure is a way around this with Linux VMs? Also if a machine locks, no way to unlock without the password.

Also we have scenarios where AI model auth is via API key. But completely agree Entra auth should be the default.

Welcome thoughts.

Ah yes of course - the VM passwords. I was looking at the AAD auth VM extensions but it doesn't look easy to get working with Guacamole - plus I couldn't see one that would work for Linux RDP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants