Security operations

Snowflake security alerts in your SIEM, with just SQL

Native webhook notifications for Splunk and Microsoft Sentinel.

Kevin Keller · kevinkeller.org

Why it matters

The telemetry is in Snowflake. The analysts are in the SIEM.

  • Failed logins, privilege escalations and unusual queries all sit in ACCOUNT_USAGE.
  • Getting them out used to need a Python UDF, an External Access Integration and a secret.
  • That is a lot of moving parts for what amounts to an HTTP POST.

What changed

A native webhook replaces the UDF

  1. Create a NOTIFICATION INTEGRATION of type WEBHOOK pointing at the SIEM.
  2. Attach the auth header through a secret.
  3. Call SYSTEM$SEND_NOTIFICATION() from an Alert or Task.

No Python UDF. No External Access Integration.

Choosing an approach

How your SIEM authenticates decides the pattern

ApproachBest for
Native webhookStatic tokens: Splunk HEC, Logic App URLs
External Access UDFExpiring OAuth with complex payloads
HybridExpiring OAuth with simple alert payloads

Native webhook

Secrets never appear in the integration or logs

  • Header values use the SNOWFLAKE_WEBHOOK_SECRET placeholder.
  • Snowflake swaps in the real secret at execution time.
  • Splunk needs Authorization: Splunk <token>. Bearer returns 403 Forbidden.
  • An alert checking every minute can post failed logins straight to Splunk.

The token problem

Static secrets go stale when OAuth tokens expire

Sentinel's Logs Ingestion API with Entra ID uses tokens that typically expire every 60 minutes. A UDF with _snowflake.get_oauth_access_token() fetches a fresh token on every call, at the cost of a Python runtime.

The hybrid

Detect in SQL, deliver natively, refresh the token in the background.

A Task refreshes the secret every 30 minutes with ALTER SECRET. Alerts keep using the native webhook.

Comparison

Native and hybrid keep latency low

NativeUDFHybrid
SetupLowHighMedium
Token refreshManual or TaskAt call timeBackground Task
LatencyLowHigherLow

Ready-made detections

Five alert conditions to start with

  • Five or more failed logins by one user.
  • A login from an IP unseen in the last 90 days.
  • New grants of ACCOUNTADMIN, SECURITYADMIN or SYSADMIN.
  • Queries returning over 1 million rows or scanning over 1 GB.
  • Queries outside business hours.

Safeguards

Run it with least privilege and an audit trail

  • Rotate SIEM tokens, and the Entra ID client secret for the hybrid.
  • Check SYSTEM$ALLOWLIST() so the SIEM accepts Snowflake's egress IPs.
  • Monitor NOTIFICATION_HISTORY for delivery failures.
  • Use a dedicated monitoring role, never ACCOUNTADMIN.

The takeaway

Start with the native webhook. Go hybrid when tokens expire.

Read the full article

Kevin Keller · kevinkeller.org