Secrets Management for Martech Integrations: Environment Variables and Rotation

Martech integrations run on API keys, tokens and passwords that sit between your warehouse, your engagement tools and your analytics. Store them in a secrets service, hand them to code by reference and agree who owns rotation before the first integration ships. This guide covers where to store them, how to read them safely and how to rotate them without an outage.

Key Takeaways

  • A secret is any value that proves one system may call another, including API keys, passwords, refresh tokens and hashing salts.
  • Pick one store per secret, and check that your runtime can read from it before you commit.
  • Give code a reference to the secret and let the platform resolve the value at run time.
  • We recommend rotating by overlap: issue the new credential, switch, confirm, then revoke the old one.
  • Give every secret one named owner and a rotation date, and record the expiry of every refresh token.
  • Two features covered here carry preview or beta labels on the vendor pages, so check their status before you build.

What counts as a secret in a martech integration?

Anything that proves your system is allowed to talk to another system. That includes API keys, database passwords, OAuth refresh tokens and webhook signing values. It also includes the hashing salt your team uses to pseudonymise identifiers before they leave the warehouse.

Databricks describes a secret as a sensitive value that notebooks, jobs and functions can use without the value appearing in code. Its examples include a password, an API key and a hashing salt. That last clause is the test to apply to every credential in your stack.

Two features below carry labels on their vendor pages. Snowflake lists DEFINE SECRET as a Preview Feature. Databricks marks secrets backed by AWS Secrets Manager as Beta.

Where should the secret live?

Pick one home per secret and write it down. The two platforms we looked at each give you a native store. The choice changes who can read the value and how rotation works.

Databricks offers workspace secret scopes and secrets in Unity Catalog. Unity Catalog secrets can also be backed by AWS Secrets Manager. The table below compares them using the vendor's own wording.

OptionWhere the value livesAccess controlTo rotate
Workspace secret scopeDatabricks, in the workspaceSecret scope permissions (no secret-level access control)Update the value in Databricks
Databricks-managed secret in Unity CatalogDatabricks, in Unity CatalogUnity Catalog privileges on the secret, schema, or catalogUpdate the value in Databricks
AWS Secrets Manager-backed secret in Unity Catalog (Beta)AWS Secrets ManagerUnity Catalog privileges on the secret, schema, or catalogRotate in AWS Secrets Manager. No change in Databricks.

For a marketing data team, the access-control column usually decides the matter. A scope applies permissions to every secret inside it.

We recommend one scope per integration owner. Never mix a billing key with a campaign-tool key.

Snowflake takes the same idea into SQL. Its CREATE SECRET command supports secret types for OAuth, cloud provider tokens, basic authentication and generic strings.

It also supports workload identity federation. There, Snowflake acts as the OpenID Connect provider for a workload.

How should code read a secret without exposing it?

Treat the secret as a reference that code resolves at run time. The Snowflake page says to supply sensitive values through environment secrets, not as plain-text literals.

Its own example, shown below, passes the value in through an environment secret function. Nobody types it into the statement.

DEFINE SECRET MY_DB.MY_SCHEMA.THIRD_PARTY_API_KEY
  TYPE = GENERIC_STRING
  SECRET_STRING = {{ _snow.env_secret("API_KEY") }}
  COMMENT = 'API key for the third-party billing service';

That example comes from the vendor page. There, DEFINE SECRET is a Preview Feature and works only inside DCM project definition files. Check its status in the current Snowflake documentation before you build a pipeline on it.

On the Databricks side, we suggest reading through dbutils.secrets in notebooks and jobs. Do not paste the value into a cell. For an environment variable on compute or on a model serving endpoint, the vendor table lists workspace secret scopes as supported.

It lists Unity Catalog secrets as not supported there. Check which store your runtime supports before you pick one.

Why does an environment variable still need a reference?

An environment variable moves the value out of the source file. It does not move it out of your estate. The variable still sits in a deployment tool, a build log or a laptop profile.

Each of those is another place to rotate. We recommend that the variable holds the secret's name or path, and the platform resolves the value.

The same rule holds for prompts and agent context. If you manage agent instructions like code, keep credentials out of the repository too. Our rule in implementation work is simple.

A person should never need to read a production credential to do the job. If a rotation needs someone to copy a value between two screens, the design has a gap.

How should rotation work?

Rotation is a sequence, and the order matters more than the schedule. We recommend that the old and new values overlap for a short time. Then no scheduled send, sync or webhook meets a rejected credential.

PhaseWhat happensOwner confirms
CreateThe destination system issues a second credential next to the live oneThe new credential has the same permissions as the old one
StoreThe new value is written to the secrets store, not to codeNobody pasted it into chat or a ticket
SwitchIntegrations read the new value on their next runOne low-risk integration ran cleanly first
RetireThe old credential is revoked at the destinationNo job has used the old value since the switch

A switch can still fail, so pair it with the alerting and replay habits in handling failed syncs. Where the store holds the live value elsewhere, rotation gets simpler. Databricks says a secret backed by AWS Secrets Manager (Beta) rotates in AWS Secrets Manager.

No change is needed in Databricks. Keep the rotation owner and the store owner as the same person.

What happens when a token expires on its own?

OAuth refresh tokens carry their own clock. Snowflake's CREATE SECRET takes an OAUTH_REFRESH_TOKEN_EXPIRY_TIME property that records when the refresh token expires. The refresh token is the value used to obtain a new access token when the access token expires.

The failure mode to plan for is the silent expiry. Nobody owns the refresh token. The integration stops obtaining access tokens.

The first sign is an empty dashboard. We recommend putting the expiry date in the integration's runbook, with an owner and a reminder well before the date.

What does this look like on a real integration?

This is a hypothetical example, not a client story. A lifecycle team syncs audience data from a warehouse to an engagement tool. The sync job uses one API key, created by a developer who has since left.

The team moves the key into a secrets store, in a scope owned by the integration owner. The job now reads it by reference. They issue a second key at the destination and switch the job to it.

Once one scheduled run succeeds, they revoke the original. Nobody pasted the value anywhere, and the leaver's old key no longer works.

Who should own each secret?

We recommend giving every secret a single named owner and a rotation date. Keep both in the integration's runbook. Ownership by team fails because every team assumes another team has the calendar reminder.

Ownership by person fails when that person moves on. The same logic applies to cost, as martech total cost of ownership shows for every cost line.

If you want help with ownership and rotation across integrations, start with two services. Our customer data management service covers data governance and CDP integration. Our product engineering service covers bespoke middleware.

What should you check before go-live?

Before an integration goes live, confirm that no credential appears in code or tickets. Confirm that every secret has an owner. Rehearse the rotation sequence once in a non-production environment.

Check that the supported surfaces of your chosen store match where the code runs. Snowflake also asks customers to keep personal and other sensitive data out of metadata. Keep secret values out of comments and tags.

Frequently Asked Questions

1. Is an environment variable a safe place for a secret?

It is better than a literal in source code, but the value still lives in whatever system sets the variable. Keep the secret in a secrets store and let the variable carry a reference where the platform allows it.

2. Which store should a Databricks team choose?

The vendor documentation compares workspace secret scopes and Unity Catalog secrets by access control, availability and supported surfaces. Choose the one that works where your code runs. Pick the finest access control you need.

3. How do I rotate a key without breaking scheduled jobs?

Issue the new credential before revoking the old one. Switch integrations one at a time. Revoke the old credential only when nothing has used it since the switch.

4. Does Snowflake need plain-text values in CREATE SECRET?

For DEFINE SECRET in a DCM project, the vendor page says to supply sensitive values through environment secrets. It advises against plain-text literals. Check the current page, because that feature is marked Preview.

5. Who owns rotation for a shared integration?

One named person, recorded in the runbook with a rotation date, and reviewed whenever the team changes.

Sources

  • Databricks, Secret management. Retrieved 06 Dec 2026.
  • Snowflake, CREATE SECRET. Retrieved 06 Dec 2026.
  • Vendor features, preview status and limits change, so check the current vendor documentation before you build. This post is a general guide and not security or legal advice.
  • Written by CustomerIK.

CustomerIK works across customer data management and product engineering.

If your integrations still depend on keys nobody owns, let's talk.

Preferences

Privacy is important to us, so you have the option of disabling certain types of storage that may not be necessary for the basic functioning of the website. Blocking categories may impact your experience on the website.

Accept all cookies
Accept all cookies

These items are required to enable basic website functionality.

Always active

These items are used to deliver advertising that is more relevant to you and your interests.

These items allow the website to remember choices you make (such as your user name, language, or the region you are in) and provide enhanced, more personal features.

These items help the website operator understand how its website performs, how visitors interact with the site, and whether there may be technical issues.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.