Snowflake Security, RBAC, and User Administration · Topic 13 of 16

Network Rules and Network Policy Precedence

Build network rules and network policies, know the rule types and modes, and predict which policy wins when account, user and integration policies overlap.

  • 5 min
  • Includes a diagram
In a nutshell
  • A network rule holds identifiers (TYPE) and a MODE; a network policy references rules in an allowed list and a blocked list.
  • Default mode is INGRESS. INTERNAL_STAGE rules take only AWSVPCEID; EGRESS rules take HOST_PORT or PRIVATE_HOST_PORT.
  • Precedence: security integration, then user, then account. The most specific policy replaces the others.

What it is

A network rule is a schema-level object that holds a list of network identifiers: IP ranges, private endpoint IDs or host names. A network policy is an account-level object that points to rules and says which ones are allowed and which are blocked. Rules describe the "what", policies decide the "allow or block".

The ADA-C02 exam tests this as an administrator decision: which rule type and mode, which privileges, and which policy takes effect when more than one is active.

Network ruleIPV4 or AWSVPCEIDlisted inNetwork policyallowed and blocked listsactivated onAccount, user or integrationchecked atSign in and requests

How it works

Rule types and modes

A rule has a TYPE (what the values are) and a MODE (where the rule is enforced). The mode defaults to INGRESS.

ModeValid typesUsed for
INGRESSIPV4, IPV6, AWSVPCEID, AZURELINKID, GCPPSCID, COMPUTE_POOLInbound traffic to the Snowflake service
INTERNAL_STAGEAWSVPCEIDAccess to internal stages
EGRESSHOST_PORT, PRIVATE_HOST_PORTOutbound traffic, such as external network access

Other points on the types:

  • IPV4 values are addresses or CIDR ranges. IPV6 is for AWS only and works only in INGRESS mode.
  • AWSVPCEID takes VPC endpoint IDs (not VPC IDs). AZURELINKID takes Azure Private Link LinkIDs. GCPPSCID takes Google Cloud PSC connection IDs.
  • HOST_PORT values are domains with an optional port; the default port is 443.
CREATE NETWORK RULE corp_ips
  MODE = INGRESS
  TYPE = IPV4
  VALUE_LIST = ('192.0.2.0/24', '198.51.100.7');

CREATE NETWORK POLICY corp_only
  ALLOWED_NETWORK_RULE_LIST = ('mydb.net.corp_ips');

Privileges and administration

  • CREATE NETWORK RULE is a schema privilege. By default ACCOUNTADMIN, SECURITYADMIN and the schema owner hold it, and it can be granted to other roles.
  • Creating a network policy needs SECURITYADMIN or higher, or the global CREATE NETWORK POLICY privilege.
  • Activating a policy on the account needs SECURITYADMIN or higher, or the global ATTACH POLICY privilege.
  • Activating a policy on a user needs OWNERSHIP on the user and USAGE on the policy.

Activation is done with the NETWORK_POLICY parameter:

ALTER ACCOUNT SET NETWORK_POLICY = corp_only;
ALTER USER svc_loader SET NETWORK_POLICY = loader_only;
ALTER ACCOUNT UNSET NETWORK_POLICY;

Older policies use ALLOWED_IP_LIST and BLOCKED_IP_LIST directly. Network rules are the current approach because they also cover private endpoints and are reusable across policies.

Watch out

A policy that does not allow your own address can lock you out. Confirm your current IP is covered before activating a policy on the account.

Precedence: which policy wins

A request is checked against the security integration policy if one exists, otherwise the user policy, otherwise the account policy; the most specific policy wins and is not merged with the others. Policies can be active at three levels, and the most specific one wins.

LevelWins overLoses to
AccountNothingUser, integration
UserAccountSecurity integration
Security integrationUser and accountNothing

A user with their own policy is checked only against that policy; the account policy is not merged in. A user without one falls back to the account policy. SCIM, Snowflake OAuth and External OAuth integrations support their own policies, which is how you let an identity provider connect without opening the account to everyone.

Request arriveshas integration policy?Integration policy appliesRequest arriveselse user policy?User policy appliesRequest arriveselseAccount policy applies

Two more rules decide edge cases:

  • Blocked beats allowed. If an identifier is in both lists, Snowflake blocks it. The same holds for rule lists.
  • Private connectivity rules beat IP rules. AWSVPCEID and AZURELINKID rules take precedence over IPV4 and IPV6 rules.

A rule that lists only VPC endpoint IDs or LinkIDs has no effect on public requests. To block public access while allowing a private endpoint, use one policy with an allowed rule for the endpoint and a blocked rule for the public ranges.

Common mistakes

Assuming the account policy still applies to a user who has their own. It does not; the user policy replaces it for that user.

Expecting a user policy to restrict a SCIM or OAuth integration. An integration-level policy is more specific and wins. For Snowflake OAuth token requests, the user-level policy is not considered.

Writing only a private endpoint rule and thinking public access is closed. Public requests are untouched unless you block them as well.

Mixing up modes. An INTERNAL_STAGE rule protects stages only. Setting it does nothing until ENFORCE_NETWORK_RULES_FOR_INTERNAL_STAGES is enabled, and when that is on, the old IP lists are no longer used for stage access.

Using a policy on an integration for stage protection. An integration-level policy does not restrict internal stage access.

What to remember for the exam

  • A network rule holds identifiers (TYPE) and a MODE; a network policy references rules in an allowed list and a blocked list.
  • Default mode is INGRESS. INTERNAL_STAGE rules take only AWSVPCEID; EGRESS rules take HOST_PORT or PRIVATE_HOST_PORT.
  • Precedence: security integration, then user, then account. The most specific policy replaces the others.
  • Blocked values always win over allowed ones.
  • Needed privileges: CREATE NETWORK RULE on the schema, CREATE NETWORK POLICY and ATTACH POLICY globally (or SECURITYADMIN).

Check yourself

  • A user has a network policy and the account has another. Which one governs that user?

    The user policy only; it overrides the account policy and is not combined with it.

  • An address appears in the allowed list and the blocked list. What happens?

    It is blocked, because blocked values take precedence.

  • Which rule mode and type protect internal stages on AWS?

    MODE = INTERNAL_STAGE with TYPE = AWSVPCEID, with the stage enforcement parameter enabled.

Topic 13 of 16 in Snowflake Security, RBAC, and User Administration

Test yourself on Snowflake Security, RBAC, and User Administration

The full Snowflake ADA-C02 question bank has 814 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Snowflake. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.