3 May 2025, Sat

Network Rules in Snowflake

How to Configure Network Rules in Snowflake

🔐 How to Configure Network Rules in Snowflake: A Step-by-Step Security Guide

In today’s data-driven enterprises, securing access to cloud platforms like Snowflake is essential. One of the most powerful tools Snowflake provides for managing access is the Network Policy feature, which enables administrators to define IP-level restrictions. Whether you want to enforce access through a corporate VPN or block suspicious regions, configuring network rules in Snowflake ensures that only authorized IPs can interact with your data.

In this article, we’ll walk through everything you need to know about configuring network rules (network policies) in Snowflake, step-by-step.


🚧 What Are Network Policies in Snowflake?

Network Policies in Snowflake are security controls that allow you to:

  • Whitelist specific IPs or IP ranges (ALLOWED_IP_LIST)
  • Blacklist specific IPs or IP ranges (BLOCKED_IP_LIST)
  • Apply restrictions at the user level or account-wide

These policies help ensure that only clients from trusted IP addresses can connect to your Snowflake instance—via the UI, JDBC, ODBC, SnowSQL, or REST API.


🧰 Prerequisites

Before you begin:

  • You must have the ACCOUNTADMIN role or a role with the CREATE NETWORK POLICY privilege.
  • IPs used in policies must be public IP addresses (no internal/private IPs like 192.168.x.x).
  • Ensure you include your current IP to avoid locking yourself out.

🛠 Step-by-Step: Configuring Network Policies in Snowflake

🔹 Step 1: Create the Network Policy

Start by creating a named policy with one or more allowed IP addresses and optional blocked IPs.

CREATE NETWORK POLICY office_policy
  ALLOWED_IP_LIST = ('203.0.113.0/24', '198.51.100.12')
  BLOCKED_IP_LIST = ('192.0.2.0/24');

Tip: Use CIDR notation to allow an entire range (e.g., a corporate VPN pool).


🔹 Step 2: Assign the Policy to a Specific User (Optional)

To test the policy safely, apply it to just one user first.

ALTER USER jdoe SET NETWORK_POLICY = office_policy;

Later, to remove it:

ALTER USER jdoe UNSET NETWORK_POLICY;

This lets you test access and behavior before affecting the entire account.


🔹 Step 3: Apply the Policy at the Account Level (Global Enforcement)

Once tested, you can apply the policy to all users and services under your Snowflake account:

ALTER ACCOUNT SET NETWORK_POLICY = office_policy;

To remove a global policy:

ALTER ACCOUNT UNSET NETWORK_POLICY;

🔍 Step 4: View and Audit Network Policies

To list all created policies:

SHOW NETWORK POLICIES;

To inspect the current account-level policy:

SELECT * FROM SNOWFLAKE.ACCOUNT_USAGE.ACCOUNT_PARAMETERS
WHERE parameter_name = 'NETWORK_POLICY';

To check a specific user’s assigned policy:

SHOW USERS LIKE 'jdoe';

🧠 Best Practices

TipWhy It Matters
✅ Always test user-level firstPrevent accidental lockouts
✅ Use CIDR rangesSimplifies management of large IP blocks
✅ Maintain a changelog of IPsAuditing and compliance reasons
✅ Combine with MFA and RBACEnsures layered security

⚠️ Common Mistakes to Avoid

  • Forgetting to whitelist your own IP: You can lock yourself out of the platform.
  • Using private IP ranges: Snowflake only recognizes public IPs.
  • Incorrect CIDR formatting: For example, /33 is invalid (max for IPv4 is /32).

🧩 Automating with Terraform or Scripting

Snowflake network policies can be integrated into Infrastructure-as-Code workflows. Using tools like Terraform or Snowflake’s Python Connector, you can version and apply policies in CI/CD pipelines.

Need help writing a Terraform module or script? Just ask.


📘 Final Thoughts

Configuring network rules in Snowflake isn’t just a one-time task—it’s a critical part of your security posture. By carefully setting up and managing network policies, you reduce attack surfaces and maintain compliance with internal and external security standards.


📚 Resources


🔖 Hashtags

#Snowflake #DataSecurity #CloudSecurity #NetworkPolicy #DataEngineering #SnowflakeTips #SQLSecurity #RBAC #SnowflakeAdmin