ALTER NETWORK POLICY

statementsupportedIntegrations, network & secrets

docs.snowflake.com ↗

Object: NETWORK POLICY

Modifies the properties for an existing network policy. Note Only the network policy owner (that is, the role with the OWNERSHIP privilege on the network policy) or higher can alter a network policy.

Syntax

supportedpartialnot supportednot scored

ALTER NETWORK POLICY [ IF EXISTS ] <name> SET {
    [ ALLOWED_NETWORK_RULE_LIST = ( '<network_rule>' [ , '<network_rule>' , ... ] ) ]
    [ BLOCKED_NETWORK_RULE_LIST = ( '<network_rule>' [ , '<network_rule>' , ... ] ) ]
    [ ALLOWED_IP_LIST = ( [ '<ip_address>' ] [ , '<ip_address>' ... ] ) ]
    [ BLOCKED_IP_LIST = ( [ '<ip_address>' ] [ , '<ip_address>' ... ] ) ]
    [ COMMENT = '<string_literal>' ] }

ALTER NETWORK POLICY [ IF EXISTS ] <name> UNSET COMMENT

ALTER NETWORK POLICY <name> ADD { ALLOWED_NETWORK_RULE_LIST = ( '<network_rule>' [ , ... ] ) | BLOCKED_NETWORK_RULE_LIST = ( '<network_rule>' [ , ... ] ) }

ALTER NETWORK POLICY <name> REMOVE { ALLOWED_NETWORK_RULE_LIST = ( '<network_rule>' [ , ... ] ) | BLOCKED_NETWORK_RULE_LIST = ( '<network_rule>' [ , ... ] ) }

ALTER NETWORK POLICY <name>  RENAME TO <new_name>

ALTER NETWORK POLICY <name> SET TAG <tag_name> = '<tag_value>' [ , <tag_name> = '<tag_value>' ... ]

ALTER NETWORK POLICY <name> UNSET TAG <tag_name> [ , <tag_name> ... ]

Parameters

NameRequiredDescription
nameSpecifies the identifier for the network policy to alter. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.
SET ...Specifies the parameter to set for the network policy:
ALLOWED_NETWORK_RULE_LIST = ( 'network_rule' [ , 'network_rule' , ... ] )Specifies a list of network rules that contain the network identifiers that are allowed access to Snowflake. There is no limit on the number of network rules in the list. Replaces existing network rules in the allowed list. To add network rules without replacing existing ones, use the ALTER NETWORK POLICY ... ADD command.
BLOCKED_NETWORK_RULE_LIST = ( 'network_rule' [ , 'network_rule' , ... ] )Specifies a list of network rules that contain the network identifiers that are denied access to Snowflake. There is no limit on the number of network rules in the list. Replaces existing network rules in the blocked list. To add network rules without replacing existing ones, use the ALTER NETWORK POLICY ... ADD command.
ALLOWED_IP_LIST = ( [ ip_address ] [ , ip_address , ... ] )Specifies a list of IPv4 addresses that are allowed access to your Snowflake account. This is referred to as the allowed list. Snowflake recommends using network rules in conjunction with network policies rather than using this property. Use the ALLOWED_NETWORK_RULE_LIST property to specify network rules that contain IPv4 or IPv6 addresses. If you are not yet using network rules, specify at least one IPv4 address or CIDR block range to allow access to your Snowflake account. Additionally, if you are not using network rules and this property is specified with an empty list, no IPv4 addresses are allowed to access your Snowflake account. Note The ALLOWED_IP_LIST parameter supports IPv4 addresses only. To allow or block IPv6 addresses, use network rules with TYPE = IPV6 and add them to the ALLOWED_NETWORK_RULE_LIST or BLOCKED_NETWORK_RULE_LIST. IPv4 and IPv6 network rules are evaluated independently, so if your network has dual-stack (IPv4 and IPv6) traffic, create separate network rules for each address family and add both to the network policy. To enable IPv6 ingress for your account, see IPv6 addresses.
BLOCKED_IP_LIST = ( [ ip_address ] [ , ip_address , ... ] )Specifies a list of IPv4 addresses that are denied access to your Snowflake account. This is referred to as the blocked list. To unset this parameter, specify a different CIDR block range, a series of IPv4 addresses, or a single IPv4 address. Snowflake recommends using network rules in conjunction with network policies rather than using this parameter. Use the BLOCKED_NETWORK_RULE_LIST property to specify network rules that contain IPv4 or IPv6 addresses. To block public access, use a network rule and add the network rule to the BLOCKED_NETWORK_RULE_LIST property. The result is that only IP addresses that use private connectivity, such as AWS PrivateLink, can access your Snowflake account. Default: No value; no IP addresses in ALLOWED_IP_LIST property are blocked.
COMMENT = 'string_literal'Adds a comment or overwrites an existing comment for the network policy.
TAG tag_name = 'tag_value' [ , tag_name = 'tag_value' , ... ]Specifies the tag name and the tag string value. The tag value is always a string, and the maximum number of characters for the tag value is 256. For information about specifying tags in a statement, see Tag quotas.
UNSET ...Specifies the properties to unset for the network policy, which resets them to the defaults: COMMENT, which removes the comment, if one exists, for the network policy. TAG tag_name [ , tag_name ... ]
ADD { ALLOWED_NETWORK_RULE_LIST = ( 'network_rule' [ , ... ] ) | BLOCKED_NETWORK_RULE_LIST = ( 'network_rule' [ , ... ] ) }Adds a network rule to the allowed or blocked list of the network policy without removing existing ones. Specify the network rule list using parentheses, for example ALLOWED_NETWORK_RULE_LIST = ('rule_name').
REMOVE { ALLOWED_NETWORK_RULE_LIST = ( 'network_rule' [ , ... ] ) | BLOCKED_NETWORK_RULE_LIST = ( 'network_rule' [ , ... ] ) }Removes a network rule from the allowed or blocked list of the network policy.
RENAME TO ...Specifies a new name for the existing network policy.

Usage notes

Access control requirements

A role used to execute this operation must have the following privileges at a minimum: Privilege | Object | Notes OWNERSHIP | Network policy | Modifying a network policy requires a role with the OWNERSHIP privilege on the network policy. For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.

Example

For example, use ALTER NETWORK POLICY to change a network policy named allow_access_policy that allows network traffic defined by allow_access_rule to also block network traffic defined by block_access_rule, consistent with the network rules defined in IP ranges. First, show the current policy: Next, change allow_access_policy to also use block_access_rule, and then show the updated policy: Next, rename the updated policy to describe use of both rules: Then, add a comment which describes that limit_access_policy is defined by network rules: Output from SHOW NETWORK POLICIES includes the updated policy name, and comment included in the changed (altered) network policy. Unlike SET, the ADD and REMOVE actions are additive: they change the allowed or blocked network rule list without replacing the entire list. Add extra_access_rule to the allowed network rule list of limit_access_policy without removing the rules already present: Remove extra_access_rule from the allowed network rule list, leaving the rest of the list unchanged:

See also

Referenced by