Latest Dynatrace uses the new credential vault API and SDK. With this change, credential vault access uses dedicated permissions like the rest of the platform, instead of the broad Classic environment:roles:viewer role.
This change affects everything that reads stored credentials:
Dashboards and
Notebooks: update the code and permissions at any time before you move to the Latest Dynatrace, and test them right away.The following table compares Classic and Latest Dynatrace for credential vault access.
| Classic | Latest Dynatrace | |
|---|---|---|
| API endpoint | /api/v2/credentials | /platform/credential-vault/v1/entries |
| IAM permission | environment:roles:viewer | credential-vault:entries:read |
| Workflows authorization setting (non-service-user actors) | environment-api:credentials:read | credential-vault:entries:read |
| SDK client | credentialVaultClient | credentialVaultEntriesClient in @dynatrace-sdk/client-credential-vault (v1.1.0+) |
| Entry ID prefix | CREDENTIALS_VAULT- | CREDENTIAL_VAULT_ENTRY- |
For the IAM permission, the default policies Standard User, Pro User, and Admin User include credential-vault:entries:read. If your users and service users get their permissions through one of these policies, you don't need to change anything. If they use custom policies, make sure those policies include credential-vault:entries:read.
Code that creates, updates, or deletes credential vault entries also needs credential-vault:entries:write.
Every credential vault entry already has a Classic ID and a new Smartscape ID, and both work with the new API and SDK. You don't need to update credential references in monitors, workflows, dashboards, or notebooks. For new content, use the CREDENTIAL_VAULT_ENTRY- ID.
Run JavaScript tasks, JavaScript code in dashboards and notebooks, and app functions that read or manage credentials must switch from credentialVaultClient to credentialVaultEntriesClient in the @dynatrace-sdk/client-credential-vault package.
Before:
import { credentialVaultClient } from '@dynatrace-sdk/client-classic-environment-v2';const { token } = await credentialVaultClient.getCredentialsDetails({ id: 'CREDENTIALS_VAULT-XXXXXXXXXXXXXXXX' });
After:
import { credentialVaultEntriesClient } from '@dynatrace-sdk/client-credential-vault';const { token } = await credentialVaultEntriesClient.getCredentialVaultEntryDetails({ entryId: 'CREDENTIAL_VAULT_ENTRY-XXXXXXXXXXXXXXXX' });
The client name and method names have changed, and the id parameter is now entryId:
| Operation | Classic SDK | New SDK |
|---|---|---|
| List | listCredentials() | listCredentialVaultEntries() |
| Create | createCredentials() | createCredentialVaultEntry() |
| Get | getCredentials() | getCredentialVaultEntry() |
| Get details | getCredentialsDetails() | getCredentialVaultEntryDetails() |
| List details | getCredentialsDetailsList() | listCredentialVaultEntryDetails() |
| Update | updateCredentials() | updateCredentialVaultEntry() |
| Delete | removeCredentials() | deleteCredentialVaultEntry() |
getCredentialVaultEntry() returns entry metadata only. To retrieve the secret value, use getCredentialVaultEntryDetails().
Who needs the new permissions depends on where the code runs.
Every workflow runs under an actor, the user or service user whose permissions determine what the workflow can access. The actor needs permissions in two places:
Workflows, which can only use the permissions the user has authorized. To change them, the user goes to
Workflows > Settings > Authorization settings and turns on the permission under Secondary permissions. Only that user can change their own authorization settings.If a permission is missing, tasks that read credentials fail with a 403 error.
Before you start
The new SDK already works before you move to the Latest Dynatrace, so you can switch and test at any time.
credential-vault:entries:read through an IAM policy. If the code creates, updates, or deletes entries, the actor also needs credential-vault:entries:write.credential-vault:entries:read in their own authorization settings. An administrator can't do this for them.You don't need to change the task. Until you move to the Latest Dynatrace, the actor needs both the Classic and the new permissions. Don't remove the Classic permissions before the move.
Find the actors of HTTP request tasks that use credentials. To list the users and service users that run workflows with HTTP request tasks that read credentials, run the following query in
Notebooks. It returns one row per actor, with the last call, the number of calls, the number of denied calls (403), and the IDs of the workflows.
fetch dt.system.events, from:-30d| filter event.kind == "AUDIT_EVENT" and event.provider == "API_GATEWAY"| filter dt.app.id == "dynatrace.automations" and dt.app.function == "api/http-function"| filter startsWith(resource, "/platform/classic/environment-api/v2/credentials")or startsWith(resource, "/platform/credential-vault/")| summarize{last_used = max(timestamp),calls = count(),denied = countIf(event.outcome == "403"),workflows = collectDistinct(details.dt.automation_engine.workflow.id)},by: { user.id }| lookup [fetch dt.system.events, from:-30d| filter event.kind == "BILLING_USAGE_EVENT" and isNotNull(user.email)| summarize n = count(), by: { user.id, user.email }], sourceField: user.id, lookupField: user.id, fields: { user.email }| fieldsAdd service_user = if(isNull(user.email), "unknown",else: if(endsWith(user.email, "@service.sso.dynatrace.com"), "yes", else: "no"))| fields user.id, user.email, service_user, last_used, calls, denied, workflows| sort last_used desc
The service_user column shows whether the actor is a service user. It shows unknown if the query can't resolve the user ID to an email address. If some workflows run less often than every 30 days, increase the from: timeframe.
Make sure the actor has environment:roles:viewer and credential-vault:entries:read through IAM policies.
If the actor isn't a service user, the actor must turn on both environment-api:credentials:read and credential-vault:entries:read in their own authorization settings. An administrator can't do this for them.
Make sure the credential entries still allow access.
This step is optional. We recommend using service users as actors for workflows that several people work on and that serve a production use case. A service user as actor has two advantages:
To assign a service user as actor, you need the iam:service-users:use permission.
JavaScript code in dashboards and notebooks runs with the permissions of the user who runs it. Authorization settings and service users don't apply.
credential-vault:entries:read through an IAM policy. If the code creates, updates, or deletes entries, the user also needs credential-vault:entries:write.If a permission is missing, the code fails with a 403 error.
You don't need to change your credential entries for the upgrade. As a reminder, workflows, dashboards, and notebooks can only use a credential if its AppEngine scope and access settings allow it:
Workflows is selected.After you update the code and permissions, run the workflow or the code and confirm that it completes successfully. For Run JavaScript tasks, dashboards, and notebooks, you can do this before you move to the Latest Dynatrace. For HTTP request tasks, do it after you move to the Latest Dynatrace, or wait for the next scheduled execution.
Then remove environment:roles:viewer from the actor or user, unless they need it for other purposes. If the actor isn't a service user, they can also turn off environment-api:credentials:read in their authorization settings.
If code or a task that uses a credential fails, for example with a 403 error, check the following:
credential-vault:entries:read through an IAM policy (HTTP request tasks before you move to the Latest Dynatrace: also environment:roles:viewer). See Update permissions. Custom policies and policy boundaries can remove a permission that a default policy grants.credential-vault:entries:read is turned on under Secondary permissions in the authorization settings (HTTP request tasks before you move to the Latest Dynatrace: also environment-api:credentials:read).