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
- A network rule holds identifiers (
TYPE) and aMODE; a network policy references rules in an allowed list and a blocked list. - Default mode is
INGRESS.INTERNAL_STAGErules take onlyAWSVPCEID;EGRESSrules takeHOST_PORTorPRIVATE_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.
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.
| Mode | Valid types | Used for |
|---|---|---|
INGRESS | IPV4, IPV6, AWSVPCEID, AZURELINKID, GCPPSCID, COMPUTE_POOL | Inbound traffic to the Snowflake service |
INTERNAL_STAGE | AWSVPCEID | Access to internal stages |
EGRESS | HOST_PORT, PRIVATE_HOST_PORT | Outbound traffic, such as external network access |
Other points on the types:
IPV4values are addresses or CIDR ranges.IPV6is for AWS only and works only inINGRESSmode.AWSVPCEIDtakes VPC endpoint IDs (not VPC IDs).AZURELINKIDtakes Azure Private Link LinkIDs.GCPPSCIDtakes Google Cloud PSC connection IDs.HOST_PORTvalues 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 RULEis a schema privilege. By defaultACCOUNTADMIN,SECURITYADMINand the schema owner hold it, and it can be granted to other roles.- Creating a network policy needs
SECURITYADMINor higher, or the globalCREATE NETWORK POLICYprivilege. - Activating a policy on the account needs
SECURITYADMINor higher, or the globalATTACH POLICYprivilege. - Activating a policy on a user needs
OWNERSHIPon the user andUSAGEon 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.
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
Policies can be active at three levels, and the most specific one wins.
| Level | Wins over | Loses to |
|---|---|---|
| Account | Nothing | User, integration |
| User | Account | Security integration |
| Security integration | User and account | Nothing |
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.
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.
AWSVPCEIDandAZURELINKIDrules take precedence overIPV4andIPV6rules.
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 aMODE; a network policy references rules in an allowed list and a blocked list. - Default mode is
INGRESS.INTERNAL_STAGErules take onlyAWSVPCEID;EGRESSrules takeHOST_PORTorPRIVATE_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 RULEon the schema,CREATE NETWORK POLICYandATTACH POLICYglobally (orSECURITYADMIN).
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_STAGEwithTYPE = 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.