# Accessing Credential Vault Secrets Securely from Workflow TypeScript Code

**URL:** <https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482>\
**Category:** Automations\
**Tags:** workflows\
**Created:** [July 16, 2026, 1:26pm UTC](https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482 "2026-07-16T13:26:29Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarwanC](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marwanc/32/34480_2.png) [@MarwanC](https://community.dynatrace.com/u/MarwanC)\
**Post date:** [July 16, 2026, 1:26pm UTC](https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482/1 "2026-07-16T13:26:29Z")

</div>

# Accessing Credential Vault Secrets Securely from Workflow TypeScript Code

Hello Dynatrace Community Colleagues,

I am currently implementing a workflow that needs to manage and rotate authentication tokens using the Dynatrace Credential Vault. Storing and rotating the token itself is not a problem, as I can leverage the **Credential Vault APIs (ClientVault API / native Dynatrace credential management capabilities)** to create, update, and rotate secrets.

The challenge is related to **secure secret consumption** within a custom Workflow task implemented in **TypeScript**.

## Current Situation

My workflow needs to call external AWS APIs. To authenticate these calls, I need access to a token that is stored in the Dynatrace Credential Vault.

I want to avoid the following approaches:

- Hardcoding the token in the workflow definition.
- Storing the token in local variables.
- Exposing the secret in workflow inputs, outputs, logs, or task parameters.
- Persisting the token anywhere outside the Dynatrace Credential Vault.

## What I Am Trying to Achieve

The built-in **Workflow HTTP Task** appears to be able to reference credentials stored in the Credential Vault and transparently inject them into outbound HTTP requests without exposing the underlying secret value.

My question is:

> Is there an equivalent mechanism available for custom TypeScript code running in Workflows like the current HTTP Task of a workflow?

More specifically:

1. How does the Workflow HTTP Task securely retrieve credentials from the Credential Vault?
2. Which internal Dynatrace service or API is used for secret resolution?
3. Can custom workflow code access secrets through the same mechanism without exposing the secret material?
4. Is there a supported SDK, API, or execution context that allows a workflow application to consume vault-managed credentials securely?

## Technical Context

From what I understand, credentials are managed through the Dynatrace Credential Vault and can be referenced by resources internally. However, the retrieval path used by native workflow tasks does not seem to be publicly documented for custom applications.

For example, when configuring an HTTP Task:

- A credential object is selected.
- The task executes successfully.
- The secret value is never exposed in the workflow definition or execution details which is indeed as intended by a credential vault design and principle.

This suggests that Dynatrace performs secure server-side secret resolution and injection.

I would like to understand whether custom TypeScript workflow code can leverage the same capability.

## Alternative Recommendations

If direct access is intentionally restricted, I would appreciate guidance on recommended architectural patterns, such as:

- Using OAuth credentials managed by Dynatrace.
- Delegating AWS calls through a Workflow HTTP Task.
- Using service-to-service authentication mechanisms.
- Any supported secret-broker or credential-injection pattern for Workflow applications.

The Dynatrace Credential Vault and its APIs are powerful for secret lifecycle management, but currently they appear primarily geared toward Dynatrace-managed integrations. I am looking for a secure and supported way for custom workflow applications to consume those secrets without exposing them.

Any guidance, best practices, or product recommendations would be greatly appreciated.

Thank you.

---

<div class="post-metadata">

**Author:** ![p\_devulapalli](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/p_devulapalli/32/41590_2.png) [@p\_devulapalli](https://community.dynatrace.com/u/p_devulapalli)\
**Post date:** [July 17, 2026, 2:03am UTC](https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482/2 "2026-07-17T02:03:13Z")

</div>

[@MarwanC](https://community.dynatrace.com/user/64346)&nbsp;Have you considered using credentialvaultclient ?

> **[credentialVaultClient​ - Classic environment v2 | Dynatrace Developer](https://developer.dynatrace.com/develop/sdks/client-classic-environment-v2/#credentialvaultclient)**
>
> Documentation of the Dynatrace Environment API v2. Resources here generally supersede those in v1. Migration of resources from v1 is in progress. | Client for the Dynatrace Environment API v2

---

<div class="post-metadata">

**Author:** ![sujit\_k\_singh](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sujit\_k\_singh](https://community.dynatrace.com/u/sujit_k_singh)\
**Post date:** [July 17, 2026, 5:23am UTC](https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482/3 "2026-07-17T05:23:47Z")

</div>

Hello&nbsp;[@MarwanC](https://community.dynatrace.com/user/64346)

Yes, credentialVaultClient from the @dynatrace-sdk/client-classic-environment-v2 package is exactly the mechanism you’re looking for.

To answer your specific questions:

Points 1/2 — HTTP Task credential resolution: Correct. The HTTP Task resolves credentials server-side through the Credential Vault service. The secret value never appears in the workflow definition, execution history, or logs — only the credential ID is stored in the task configuration.

Points 3/4 — Custom TypeScript access: Correct. The “Run JavaScript” (ad-hoc action) task in a Workflow runs in an authenticated app context and can call credentialVaultClient directly from @dynatrace-sdk/client-classic-environment-v2.

Thanks,

Sujit

---

<div class="post-metadata">

**Author:** ![MarwanC](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marwanc/32/34480_2.png) [@MarwanC](https://community.dynatrace.com/u/MarwanC)\
**Post date:** [July 17, 2026, 9:26am UTC](https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482/4 "2026-07-17T09:26:36Z")

</div>

You may have miss read what I am really looking for, in the API there is no way to extract the token itself, the main usage in my workflow is to read the token from the vault and use it in a code to call another http call all by code, i.e. I need the actual token. I do not see any API that do this, please point me to the exact field that I can fetch the token value from. Here is the simplest code fragment that I can provide and it works fine from my task like but no token to use given the ID:

import { credentialVaultClient } from “@dynatrace-sdk/client-classic-environment-v2”;

import { execution } from ‘@dynatrace-sdk/automation-utils’;

// According to documentation  
// The credentials set including username/certificate, password or token is included in the response.

const response = await credentialVaultClient.getCredentials  
(  
&nbsp; {  
&nbsp; &nbsp; id: “CREDENTIALS\_VAULT-DE4276F37CF26CCC”  
&nbsp; }  
);

console.log(response.credentialUsageSummary);  
console.log(response.description);  
console.log(response.externalVault);  
console.log(response.id);  
console.log(response.name);  
console.log(response.owner);  
console.log(response.ownerAccessOnly);  
console.log(response.scope);  
console.log(response.type);

---

<div class="post-metadata">

**Author:** ![MarwanC](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marwanc/32/34480_2.png) [@MarwanC](https://community.dynatrace.com/u/MarwanC)\
**Post date:** [July 17, 2026, 12:43pm UTC](https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482/5 "2026-07-17T12:43:14Z")

</div>

console.log(response.token);&nbsp; &nbsp; ---- Always returns undefined

---

<div class="post-metadata">

**Author:** ![sujit\_k\_singh](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sujit\_k\_singh](https://community.dynatrace.com/u/sujit_k_singh)\
**Post date:** [July 21, 2026, 11:51am UTC](https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482/6 "2026-07-21T11:51:07Z")

</div>

Hi&nbsp;[@MarwanC](https://community.dynatrace.com/user/64346)

You’re right, I should have been clearer. This is by design the Credential Vault never returns raw secrets through the API.

Unfortunately, there is no field that returns the actual token value. The getCredentials() response only contains metadata (name, type, scope, owner, etc.) no token or secret field exists.

This is a hard security boundary, Dynatrace intentionally never exposes raw secrets through the SDK in workflow code.

The only way to use vault credentials is through the built-in HTTP Request task, which resolves the secret server-side at execution time. The pattern is:

JavaScript task → prepare your request logic/body  
HTTP Request task → make the authenticated call using Credential Vault (secret injected server-side, never exposed)  
There’s no workaround to extract the raw token in TypeScript — it’s by design.

Thanks,

Sujit

---

<div class="post-metadata">

**Author:** ![MarwanC](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marwanc/32/34480_2.png) [@MarwanC](https://community.dynatrace.com/u/MarwanC)\
**Post date:** [July 22, 2026, 3:08pm UTC](https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482/7 "2026-07-22T15:08:38Z")

</div>

Indeed the API is not usable via your own code, only if we call an API direct inside an HTTP task. This will ne be enough as we need to do a complex API calls, I also tried an app function but the method that used to exist also removed

export async function getVaultToken(credentialId: string) {  
&nbsp; // Add you test ID here&nbsp; //let credentialId = ‘CREDENTIALS\_VAULT-39E8BDA0E5B29E55’;&nbsp; // You need also a scope to use this&nbsp; // Select the AppEngine scope to permit built-in apps from the latest Dynatrace to access a credential.

try {&nbsp; &nbsp; // Extract Token from Vault &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; const credential = await credentialVaultClient.getCredentialWithSecrets({ id: credentialId });&nbsp; &nbsp; const token = credential.name; &nbsp;// here we need .token but is not in the API here but it is in there when is used in the Workflow strange&nbsp; &nbsp; const message1 = `${credentialId} - Id was succeffully used.`;&nbsp; &nbsp; return { token: token };&nbsp; } catch (error: unknown) {&nbsp; &nbsp; let errorDetails = “”;&nbsp; &nbsp; if (error instanceof Error) {&nbsp; &nbsp; &nbsp; errorDetails = `Error name: ${error.name}\n` +&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;`Error message: ${error.message}\n` +&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(error.stack ? `Stack trace: ${error.stack}` : “No stack trace available.”);&nbsp; &nbsp; } else {&nbsp; &nbsp; &nbsp; errorDetails = `Unknown error object: ${JSON.stringify(error, null, 2)}`;&nbsp; &nbsp; } &nbsp;&nbsp; &nbsp; const message = `${credentialId} - Token was not successfully fetched.`;&nbsp; &nbsp; return { message };&nbsp; }}I have also an open ticket with Dynatrace but so far no one is able to provide an answer if this is possible

---

<div class="post-metadata">

**Author:** ![sujit\_k\_singh](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sujit\_k\_singh](https://community.dynatrace.com/u/sujit_k_singh)\
**Post date:** [July 23, 2026, 9:31am UTC](https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482/8 "2026-07-23T09:31:11Z")

</div>

Hi&nbsp;[@MarwanC](https://community.dynatrace.com/user/64346)

Thanks for sharing your findings.

From what you’ve shown, it appears that getCredentialWithSecrets() is either no longer available or no longer exposes the underlying secret material, and neither getCredentials() nor the current SDK APIs return the token value itself.

The fact that the HTTP Request task can use the credential while custom code cannot access the secret suggests that Dynatrace is performing credential resolution and injection within a privileged internal service rather than exposing the raw secret to Workflow/AppEngine code.

I understand the HTTP task chaining approach won’t work for your use case given the complexity of your API calls. Unfortunately, I haven’t found any currently documented SDK/API that allows a Workflow JavaScript task or App Function to retrieve the actual vault token value.

Based on the behavior you’ve observed, your support ticket is probably the best path to get a definitive answer from Engineering on whether this limitation is intentional or if there’s a supported alternative for advanced custom-code scenarios.

If you receive an update from Dynatrace Support, please share it here it would be very useful for others facing similar requirements.

Thanks,

Sujit

---

<div class="post-metadata">

**Author:** ![sonja](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/sonja/32/10349_2.png) [@sonja](https://community.dynatrace.com/u/sonja)\
**Post date:** [July 24, 2026, 7:17am UTC](https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482/9 "2026-07-24T07:17:39Z")

</div>

Hi all, thanks for the great discussion here!

We’ve updated the documentation to make it clearer how to access credentials and make HTTP requests from the Run JavaScript action: [Run JavaScript action for Workflows — Dynatrace Docs](https://docs.dynatrace.com/docs/analyze-explore-automate/workflows/default-workflow-actions/run-javascript-workflow-action#make-http-requests)

Sonja

---

<div class="post-metadata">

**Author:** ![sujit\_k\_singh](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@sujit\_k\_singh](https://community.dynatrace.com/u/sujit_k_singh)\
**Post date:** [July 24, 2026, 11:17pm UTC](https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482/10 "2026-07-24T23:17:40Z")

</div>

Hi&nbsp;[@sonja](https://community.dynatrace.com/user/1281)

Thank you so much, things are much clear now.

Thanks,

Sujit

---

<div class="post-metadata">

**Author:** ![MarwanC](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/marwanc/32/34480_2.png) [@MarwanC](https://community.dynatrace.com/u/MarwanC)\
**Post date:** [August 4, 2026, 12:56pm UTC](https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482/11 "2026-08-04T12:56:22Z")

</div>

We have also developed our own API to sit on the top of your Client which makes it easier, as the documentation lacks n the area of updating the vault entry. I will share with the community.

---

<div class="post-metadata">

**Author:** ![agravier](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/agravier/32/29303_2.png) [@agravier](https://community.dynatrace.com/u/agravier)\
**Post date:** [August 4, 2026, 1:42pm UTC](https://community.dynatrace.com/t/accessing-credential-vault-secrets-securely-from-workflow-typescript-code/56482/12 "2026-08-04T13:42:48Z")

</div>

I agree with previous comments, I recommend using sdk and&nbsp;_credentialVaultClient.getCredentialsDetails method_&nbsp;:

> **[Manage secrets | Dynatrace Developer](https://developer.dynatrace.com/develop/guides/security/manage-secrets/)**
>
> Best practices to manage secrets in Dynatrace Apps for accessing external services

I use it like this :

_import { credentialVaultClient } from “@dynatrace-sdk/client-classic-environment-v2”;_

_ **const VAULT\_ID = “CREDENTIALS\_VAULT-XXXXXXXXXXXXX”;** _

_export default async function ({ executionId }) {_  
_const ex = await execution(executionId);_  
_**const creds = await credentialVaultClient.getCredentialsDetails({ id: VAULT\_ID });**_

_const headers = {_  
_‘accept’: ‘application/json; charset=utf-8’,_  
_ **‘Authorization’: `Api-Token ${creds.token}`,** _  
_‘Content-Type’: ‘application/json; charset=utf-8’__};_

_Regards, Aurelien_
