How to Configure Snowflake Create Secret

Published
Length
3 min read

Luis Felipe Dias

All posts

The snowflake create secret command stores keys and tokens inside a database schema. Teams set it up by granting strict role permissions before linking outside services. Data teams often need to call outside APIs or cloud storage from SQL. Hardcoding keys into scripts creates a huge security risk for the whole company. Storing credentials as schema objects keeps raw keys out of shared code files. This guide covers how secret objects work and how to manage role permissions. How the snowflake c

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

The snowflake create secret command stores keys and tokens inside a database schema. Teams set it up by granting strict role permissions before linking outside services.

Data teams often need to call outside APIs or cloud storage from SQL. Hardcoding keys into scripts creates a huge security risk for the whole company. Storing credentials as schema objects keeps raw keys out of shared code files. This guide covers how secret objects work and how to manage role permissions.

How the snowflake create secret setup works

In Snowflake, a secret is a schema-level object that holds sensitive login data. It can store OAuth tokens, basic passwords, or generic strings for custom apps. Engineers do not read the raw secret value once it is saved inside.

Instead, an admin binds the secret to an external network integration object. Stored procedures and user functions then use that integration to call outside endpoints. The platform handles the token exchange in the background during the function run.

This setup affects both human analysts and automated service roles running scheduled jobs. A safe default is to keep secret creation privileges restricted to account admins. Regular developer roles should only get usage rights on the specific secret object. Separating the owner role from the user role stops accidental edits or leaks.

Role design for stored credentials

Good role design starts with one dedicated schema for all secret objects. Do not scatter credentials across tens of different project schemas in your account. Placing them in one spot makes permission checks much faster for security teams.

Each external service should have its own separate secret and integration pair. Sharing one credential across many unrelated apps makes rotation painful and risky later. When a key changes, you only want to update one isolated database object.

Snowflake Access Control + Secret Detection in Code (TruffleHog, GitLeaks): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You should also limit which roles can bind secrets to new functions. If any role can attach a secret to code, they can misuse it. A user could write a script that sends data to an unapproved host. Tight network rules on the integration help block traffic to unknown web hosts.

Checking logs and session limits

Setting up safe role grants is only the first half of security. Security teams also need to check who creates, alters, or uses these objects. You can query the built-in account history views to track all DDL actions. These logs show which role changed a secret and when the change happened.

Static role permissions still leave gaps once a user logs into a session. Anyone with an active session and role usage rights can run linked functions. Native setup rules cannot inspect the live payload of every single query run. They also do not mask sensitive data like emails or card numbers dynamically.

If an analyst queries a table with phone numbers, the full text returns. Basic object privileges only decide if a role can run the command at all. They do not require peer approval before a high-risk query runs in production. Teams often need runtime controls to watch queries and rewrite sensitive fields live.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Who can read the raw value after a snowflake create secret run?

No user role can view the plain text password or key after creation. Only linked integrations and approved code blocks can read the value during execution.

How do teams rotate keys stored in secret objects?

An admin role runs an alter command on the secret object with new keys. For OAuth flows, the platform can refresh tokens by default using the linked integration.

Does a secret object mask sensitive data in query results?

No, secret objects only hold credentials for outside API calls and cloud storage. Rewriting fields like national IDs or emails in results requires separate masking rules.

The query runs. The emails stay hidden.