What you will be able to do
- Put the steps for enabling external access in order, from the approval decision to the function that uses the integration
- Write an EGRESS HOST_PORT network rule that allows the right host and port, and explain why an ingress rule cannot be reused
- Choose the right secret type for basic auth, API keys, OAuth and cloud provider credentials, and explain how handler code reads a secret without the credential appearing in code
- Grant the privileges each role needs, disable an integration to contain an incident, and audit outbound calls with EXTERNAL_ACCESS_HISTORY
- Apply the secure-connectivity practices for outbound calls: approve narrow destinations, use TLS, and accept that Snowflake does not inspect traffic to an allowed host
Key concept
External access integration — An account-level object that lists the egress network rules and the secrets that a UDF or procedure may use. Handler code can only reach endpoints in those rules and can only authenticate with those secrets. Any other destination is denied.
1.What an external access integration controls
UDF and stored procedure handlers in Snowflake cannot open arbitrary connections to the outside world. They reach an external host only through an external access integration, which bundles two allowlists: network rules that name the endpoints, and secrets that hold the credentials. A call to any location that is not covered by one of the integration's rules is refused. That makes the integration the security boundary for outbound traffic from code, and that boundary is what you approve.
Setup follows a fixed order, and the first step is a decision rather than an object:
- Decide whether traffic to the endpoint goes over the public internet or over private connectivity, based on the security requirements of that connection.
- Create an egress network rule for the external location.
- Create a secret to hold the credentials.
- Create the external access integration, which brings the rule and secret together.
- Grant USAGE on the integration to the developer's role, then create the UDF or procedure with
EXTERNAL_ACCESS_INTEGRATIONSandSECRETS.
Every review belongs before step 2. A network rule is not a draft. The moment a function that references the integration runs, every host the rule lists can receive data. If you create a broad rule "so developers can start" and tighten it after a pilot, the pilot sends real data to destinations nobody has approved. Testing against a live vendor in a sandbox before the review has the same problem. Decide on the destination and the path first, then build exactly what was approved.
The best practices for secure outbound connectivity all follow from one limit: the integration controls where code can connect, not what it does once connected. Snowflake enforces a hostname rule at the IP level and does not inspect the traffic. If the vendor's host also serves other services, or the vendor is compromised, the rule still lets the call through. So the approval has to cover the host itself: confirm it runs the authentic service and that nothing else on that host is reachable through the same address. Prefer HTTPS and TLS for internet endpoints, so the payload is encrypted on a path you cannot otherwise watch.
Where the requirements are stricter, change the path rather than the rule. Private connectivity keeps traffic off the public internet, and a source with no cloud private endpoint goes through the proxy described in the Data Connectivity Proxy page. An external function takes the other route: Snowflake calls a cloud provider's proxy service, which can authenticate requests before they reach the remote service. In every case the credential stays in a secret, access is limited to the roles that need it, and EXTERNAL_ACCESS_HISTORY shows what actually left.
Checkpoint 1 of 8· Put it in order
A developer needs a Python UDF that calls a vendor's API using a stored credential. Put the setup steps in the order Snowflake prescribes.
- 1.Create the UDF with EXTERNAL_ACCESS_INTEGRATIONS set to the integration and SECRETS naming the secret
- 2.Decide whether traffic to the vendor endpoint will use the public internet or private connectivity
- 3.Create an EGRESS network rule naming the vendor's endpoint
- 4.Create the external access integration that combines the network rule and the secret
- 5.Create a secret to hold the vendor credentials
The first step is a decision about the connectivity path, not an object. The rule and the secret must exist before the integration can bring them together. The UDF comes last because it references the integration and a secret that the integration lists.
“Choose whether to connect to the external network location using the public internet or private connectivity.”Source: docs.snowflake.com
Checkpoint 2 of 8· Exam question
A security team is approving a new Snowpark UDF that will send customer email addresses to a third-party enrichment API. Which order of operations should be followed to enable this external access?
Correct answer: A — Complete the vendor risk assessment, then create the egress network rule and secret, then the integration, then grant usage and create the function.
- A. Correct: the risk assessment decides whether the vendor may receive the data and which host and credential scope is acceptable, so it must precede creating any rule, secret or integration.
- B. Incorrect: testing against the live vendor already sends real or test data off-platform before the assessment has approved the endpoint, so the control comes too late.
- C. Incorrect: a broad egress rule opens outbound access before the vendor is vetted, and tightening afterwards leaves a window of unapproved data exposure.
- D. Incorrect: running the function in production before the assessment means customer data may already have reached an unapproved third party.
2.Egress network rules as the endpoint allowlist
A network rule is a schema-level object that groups network identifiers. On its own it does not say whether they are allowed or blocked: the feature that uses the rule decides that. Rules are covered in Network rules (TYPE and MODE). For external access, the rule acts as an allowlist of destinations. It must have MODE = EGRESS, a TYPE such as HOST_PORT (or PRIVATE_HOST_PORT for private endpoints), and the endpoints in VALUE_LIST. Creating one requires the CREATE NETWORK RULE privilege on its schema.
CREATE OR REPLACE NETWORK RULE google_apis_network_rule
MODE = EGRESS
TYPE = HOST_PORT
VALUE_LIST = ('translation.googleapis.com');The port is part of the rule's value and nowhere else. If an endpoint needs port 80, the entry is 'example.com:80'. A bare hostname means 443, not "any port". The integration has no port setting that could widen this, as its full set of parameters shows:
| Parameter | What it controls |
|---|---|
| ALLOWED_NETWORK_RULES | The egress rules whose endpoints handler code may reach |
| ALLOWED_API_AUTHENTICATION_INTEGRATIONS | Security integrations whose OAuth authorization server issued the secrets the code uses, or none |
| ALLOWED_AUTHENTICATION_SECRETS | The secrets handler code may use: a named list, all, or none |
| ENABLED | TRUE or FALSE: whether the integration currently allows any access |
This is why you cannot reuse a rule written for a network policy. Rules in an integration must be egress rules. A rule with MODE = INGRESS, TYPE = IPV4 filters traffic coming into the account, so it cannot list an outbound destination. You also cannot add a hostname to that rule, because every identifier in a rule must be of the same type. Nor can you attach it as a "blocked" rule, because the integration has no slot for blocked rules. The fix is a new EGRESS / HOST_PORT rule that lists only the vendor host, and the integration references only that rule.
Checkpoint 3 of 8· Check yourself
Your account already has a network rule corp_ips (MODE = INGRESS, TYPE = IPV4) attached to its network policy. A developer now needs a UDF to call api.vendor.example over HTTPS. What is the correct way to allow this destination?
An external access integration accepts only egress rules, and every identifier in a rule must be of the same type, so you cannot add a hostname to an IPV4 rule. The integration also has no place for blocked rules. You need a separate EGRESS / HOST_PORT rule for the vendor host.
“the EGRESS mode indicates the network rule will be used with an external access integration to restrict outgoing requests”Source: docs.snowflake.com
Checkpoint 4 of 8· Exam question
A Python UDF must call https://api.vendor.example:8443/v2/score. The network rule was created with VALUE_LIST = ('api.vendor.example') and every call fails with a blocked-endpoint error. What fixes this?
Correct answer: B — Change the rule's VALUE_LIST entry to 'api.vendor.example:8443', because a HOST_PORT value without an explicit port only allows port 443.
- A. Incorrect: HOST_PORT rules do support explicit ports, and IPv4 egress rules would break whenever the vendor's addresses change.
- B. Correct: HOST_PORT egress values default to port 443 when no port is given, so the non-standard port must be written into the value, such as 'api.vendor.example:8443'.
- C. Incorrect: external access integrations have no ALLOWED_PORTS parameter; the host and port allowlist lives entirely in the referenced network rules.
- D. Incorrect: INGRESS rules govern inbound connections to Snowflake and are not valid for outbound calls from handler code; response traffic needs no rule.
Checkpoint 5 of 8· Exam question
An engineer proposes reusing an existing network rule with MODE = INGRESS and TYPE = IPV4, already attached to the account network policy, in ALLOWED_NETWORK_RULES of a new external access integration for a vendor API. What is the correct approach?
Correct answer: A — Create a separate rule with MODE = EGRESS and TYPE = HOST_PORT listing the vendor hostname, and reference only that rule from the integration.
- A. Correct: external access integrations take egress rules; the HOST_PORT type names the destination host, and keeping it separate avoids touching the account network policy rule.
- B. Incorrect: INTERNAL_STAGE rules apply to internal stage access, not to outbound network destinations for handler code.
- C. Incorrect: external access integrations only take an allow list of egress rules; there is no mechanism that treats an ingress rule as an outbound exclusion.
- D. Incorrect: a rule has a single mode and type, so HOST_PORT values cannot be mixed into an IPV4 ingress rule, and editing it would alter the account network policy.
3.Snowflake secrets and the credentials they hold
A secret is a schema-level object that holds a credential so that it never has to appear as a literal in handler code. Access to it is governed by RBAC, and its contents are encrypted with keys from Snowflake's key hierarchy. Creating one requires CREATE SECRET on the schema. The TYPE you choose decides which properties you set and which credential the handler gets back.
| TYPE | Properties you set | Use it for |
|---|---|---|
| PASSWORD | USERNAME, PASSWORD | Basic authentication |
| GENERIC_STRING | SECRET_STRING | An API token or other sensitive string, but never an OAuth token |
| OAUTH2 (client credentials) | API_AUTHENTICATION, OAUTH_SCOPES | OAuth client credentials flow through a security integration |
| OAUTH2 (authorization code grant) | API_AUTHENTICATION, OAUTH_REFRESH_TOKEN, OAUTH_REFRESH_TOKEN_EXPIRY_TIME | OAuth code grant flow, where a refresh token obtains new access tokens |
| CLOUD_PROVIDER_TOKEN | API_AUTHENTICATION, ENABLED | A session with a cloud provider such as AWS, through a cloud provider security integration |
| SYMMETRIC_KEY | ALGORITHM = GENERIC | A generated 256-bit key, currently used only to generate synthetic data |
OAuth secrets do not hold the OAuth client configuration themselves. API_AUTHENTICATION names a security integration that holds the client ID, client secret, token endpoint and the other values the flow needs, and the secret refers to it. For the client credentials flow, OAUTH_SCOPES must be a subset of the integration's OAUTH_ALLOWED_SCOPES. If you leave it out, the secret inherits every scope the integration allows. For the code grant flow, the secret stores a refresh token that is used to get a new access token when the current one expires.
CREATE OR REPLACE SECRET oauth_token
TYPE = OAUTH2
API_AUTHENTICATION = google_translate_oauth
OAUTH_REFRESH_TOKEN = 'my-refresh-token';Keeping the credential in a secret means it is never written in code, but handler code still uses it at run time. The handler asks for a secret by the alias bound in its SECRETS clause and gets back only what that type returns: get_username_password returns an object with username and password attributes, get_generic_secret_string returns the string, get_oauth_access_token returns a current OAuth2 access token, and get_cloud_provider_token returns an access key ID, secret access key and token. Outside the handler the value stays hidden. DESCRIBE SECRET never shows the stored password. This supports separation of duties: one role manages the secret, and the roles that use it only need its name.
Checkpoint 6 of 8· Check yourself
A vendor API uses the OAuth authorization code grant flow. The team has a refresh token and needs a UDF handler to get current access tokens. How should the credential be stored?
OAuth tokens belong in an OAUTH2 secret, not a GENERIC_STRING secret. The OAUTH2 secret does not hold the client ID, client secret or token endpoint itself: API_AUTHENTICATION points to a security integration that holds them, and the secret stores the refresh token used to get new access tokens.
“You should not use this property to store any kind of OAuth token; use one of the other secret types for your OAuth use cases.”Source: docs.snowflake.com
4.Binding the integration and secret to a function
A function gets external access through two clauses that must agree with each other. EXTERNAL_ACCESS_INTEGRATIONS names one or more integrations. SECRETS maps an alias that handler code uses to a secret, and that secret must also be listed in the integration's ALLOWED_AUTHENTICATION_SECRETS. If a secret is bound in the function but not allowed by the integration, the integration has not authorized it, and the function cannot use it.
CREATE OR REPLACE FUNCTION has_secret_credentials()
RETURNS BOOLEAN
LANGUAGE PYTHON
RUNTIME_VERSION = 3.12
HANDLER = 'has_secret_credentials'
PACKAGES = ('snowflake-snowpark-python')
EXTERNAL_ACCESS_INTEGRATIONS = (external_access_integration)
SECRETS = ('cred' = credentials_secret )
AS
$$
from snowflake.snowpark import secrets
def has_secret_credentials():
credentials = secrets.get_username_password('cred')
return bool(credentials.username and credentials.password)
$$;Each step needs its own privilege, so an administrator controls who can turn on external access:
| Step | Role must have |
|---|---|
| CREATE NETWORK RULE | CREATE NETWORK RULE on the schema that will hold the rule |
| CREATE SECRET | CREATE SECRET on the schema that will hold the secret |
| CREATE EXTERNAL ACCESS INTEGRATION | CREATE INTEGRATION on the account, plus USAGE on each secret it uses and on that secret's schema |
| CREATE FUNCTION / CREATE PROCEDURE | USAGE on each integration it references, plus READ on each secret it references and USAGE on that secret's schema |
Two practices follow from this design. First, always put credentials in a secret rather than in code. Because only roles with READ on a secret can build a function on an integration that contains it, credential use stays auditable. Second, reuse connections. Snowflake limits the total number of connections one UDF can make, so create the HTTP client or session once when the UDF initializes, not once per row.
Checkpoint 7 of 8· Check yourself
Integration vendor_eai sets ALLOWED_AUTHENTICATION_SECRETS = (vendor_api_key). A developer's role has USAGE on vendor_eai, plus READ on the secret billing_pw and USAGE on that secret's schema. The developer creates a UDF with EXTERNAL_ACCESS_INTEGRATIONS = (vendor_eai) and SECRETS = ('cred' = billing_pw). What is the result?
Privileges on the secret are not enough. A secret bound in a function's SECRETS clause must also be listed in the integration that the function references. vendor_eai has not authorized billing_pw, so the UDF cannot use it until an administrator adds it to the integration.
“The secrets you specify as values must also be specified in the external access integration.”Source: docs.snowflake.com
Sources1
5.Switching access off and auditing outbound calls
The ENABLED switch is the fastest way to contain an incident. Suppose a vendor reports that its API tokens were compromised and dozens of functions in several schemas share one integration for that vendor. You do not have to drop or edit those functions. One statement from the integration's owner (ALTER needs OWNERSHIP) cuts all of them off from the endpoint, and every object stays in place.
ALTER EXTERNAL ACCESS INTEGRATION IF EXISTS dev_integration_disabled
SET ENABLED = FALSE;The same ALTER command can replace ALLOWED_AUTHENTICATION_SECRETS with a new secret once the credential has been rotated. After that, set ENABLED = TRUE again.
To review what code actually sent out, use the SNOWFLAKE.ACCOUNT_USAGE.EXTERNAL_ACCESS_HISTORY view, which covers the last 365 days of external access by UDF and procedure handlers. Each row is one IP address accessed by one query, with QUERY_ID, HOSTNAMES, IP, source and target cloud and region, SENT_BYTES, RECEIVED_BYTES, and a STATUS of Success or Deny. A run of Deny rows for a host is the audit-side view of a blocked endpoint, such as a call to port 8443 against a rule that only allows 443. Rows can arrive up to 180 minutes late, so this view is for review and investigation, not live alerting.
Checkpoint 8 of 8· Check yourself
Mid-incident, a vendor confirms its API tokens were stolen. Forty UDFs and procedures across several schemas call that vendor through one shared external access integration. What stops all of them from reaching the vendor while leaving every object in place?
Setting ENABLED = FALSE on the integration cuts off every handler that relies on it in one statement, without dropping or editing any function. EXTERNAL_ACCESS_HISTORY only records access after the fact and can't block anything. Revoking the token at the vendor does nothing to Snowflake's egress, so the functions can still reach the host.
“An administrator can also enable or disable the integration to manage access to external locations.”Source: docs.snowflake.com
Sources
(9)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://docs.snowflake.com/en/developer-guide/external-network-access/creating-using-external-network-accessOfficial docs
“An attempt to access a network location that is not specified by an allowed network rule will be denied.”
↩︎ What an external access integration controls“Choose whether to connect to the external network location using the public internet or private connectivity.”
↩︎ What an external access integration controls“Create an external access integration, aggregating the secret and network rule”
↩︎ What an external access integration controls“A TYPE parameter value that indicates the type of network, such as HOST_PORT or PRIVATE_HOST_PORT.”
↩︎ Egress network rules as the endpoint allowlist“a best practice is to have your secret contain a reference to a security integration that contains values needed for OAuth flow”
↩︎ Snowflake secrets and the credentials they hold“The secrets you specify as values must also be specified in the external access integration.”
↩︎ Binding the integration and secret to a function“The USAGE privilege on any integration it references.”
↩︎ Binding the integration and secret to a function“Always use a Snowflake secret to represent credentials rather than including the credentials as literal values in code.”
↩︎ Binding the integration and secret to a function“To avoid running into resource exhaustion issues, reuse connections as much as possible.”
↩︎ Binding the integration and secret to a function“the external access integration specifies those network rules and secrets that UDFs and procedures referencing the integration may use.”
↩︎ Key concept“If you omit a port number, Snowflake will use the default port number for external access, 443.”
↩︎ Exam trap 3“The secrets you specify as values must also be specified in the external access integration.”
↩︎ Exam trap 5“If you omit a port number, Snowflake will use the default port number for external access, 443.”
↩︎ Prediction“An administrator can also enable or disable the integration to manage access to external locations.”
↩︎ Checkpoint - 2.
“Snowflake will not inspect your application's traffic, so it is your responsibility to ensure that the external location's host has the authentic service”
↩︎ What an external access integration controls“Whenever possible, you should use secure protocols such as HTTPS and TLS when communicating with internet endpoints.”
↩︎ What an external access integration controls“Snowflake will not inspect your application's traffic, so it is your responsibility to ensure that the external location's host has the authentic service”
↩︎ Exam trap 1 - 3.
“The proxy service can increase security by authenticating requests to the remote service.”
↩︎ What an external access integration controls - 4.
“A network rule does not define whether its identifiers should be allowed or blocked.”
↩︎ Egress network rules as the endpoint allowlist“Each network rule contains a list of one or more network identifiers of the same type.”
↩︎ Egress network rules as the endpoint allowlist“the EGRESS mode indicates the network rule will be used with an external access integration to restrict outgoing requests”
↩︎ Checkpoint - 5.
“Only egress rules may be specified.”
↩︎ Egress network rules as the endpoint allowlist“If the integration is disabled, any handler code that relies on it will be unable to reach the external endpoint.”
↩︎ Switching access off and auditing outbound calls“Only egress rules may be specified.”
↩︎ Exam trap 2 - 6.
“stores sensitive information, limits access to the sensitive information using RBAC, and is encrypted using the Snowflake key encryption hierarchy”
↩︎ Snowflake secrets and the credentials they hold“However, if a user runs a DESCRIBE SECRET operation on the secret, the password value stored in the secret is never exposed.”
↩︎ Snowflake secrets and the credentials they hold“The connector only needs to use the secret name”
↩︎ Snowflake secrets and the credentials they hold - 7.
“This list must be a subset of the scopes defined in the OAUTH_ALLOWED_SCOPES property of the security integration.”
↩︎ Snowflake secrets and the credentials they hold“used to obtain a new access token from the OAuth authorization server when the access token expires”
↩︎ Snowflake secrets and the credentials they hold“You should not use this property to store any kind of OAuth token”
↩︎ Exam trap 4“You should not use this property to store any kind of OAuth token; use one of the other secret types for your OAuth use cases.”
↩︎ Checkpoint - 8.https://docs.snowflake.com/en/developer-guide/external-network-access/secret-api-referenceOfficial docs
“Gets the username and password from the secret specified by username_password_secret_name.”
↩︎ Snowflake secrets and the credentials they hold - 9.
“query the history of external access performed by procedure or UDF handler code within the last 365 days (1 year).”
↩︎ Switching access off and auditing outbound calls“Latency for the view might be up to 180 minutes (3 hours).”
↩︎ Switching access off and auditing outbound calls