CertSafari
    Snowflake SnowPro Advanced: Security Engineer (SEA-C01)· Lessons

    Domain 1 · Lesson 4/21

    External access integrations and Snowflake secrets

    Manage external access integrations.

    17 min read
    5.5% of exam
    9 sources
    Published 20 Oct 2026
    Docs as of 18 Oct 2026

    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:

    1. Decide whether traffic to the endpoint goes over the public internet or over private connectivity, based on the security requirements of that connection.
    2. Create an egress network rule for the external location.
    3. Create a secret to hold the credentials.
    4. Create the external access integration, which brings the rule and secret together.
    5. Grant USAGE on the integration to the developer's role, then create the UDF or procedure with EXTERNAL_ACCESS_INTEGRATIONS and SECRETS.

    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. 1.Create the UDF with EXTERNAL_ACCESS_INTEGRATIONS set to the integration and SECRETS naming the secret
    2. 2.Decide whether traffic to the vendor endpoint will use the public internet or private connectivity
    3. 3.Create an EGRESS network rule naming the vendor's endpoint
    4. 4.Create the external access integration that combines the network rule and the secret
    5. 5.Create a secret to hold the vendor credentials

    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?

    Sources123

    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.

    An egress rule that allows handler code to reach the Google Translation APIsql
    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:

    Parameters of CREATE EXTERNAL ACCESS INTEGRATION
    ParameterWhat it controls
    ALLOWED_NETWORK_RULESThe egress rules whose endpoints handler code may reach
    ALLOWED_API_AUTHENTICATION_INTEGRATIONSSecurity integrations whose OAuth authorization server issued the secrets the code uses, or none
    ALLOWED_AUTHENTICATION_SECRETSThe secrets handler code may use: a named list, all, or none
    ENABLEDTRUE 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?

    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?

    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?

    Sources415

    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.

    Secret types and what each one stores
    TYPEProperties you setUse it for
    PASSWORDUSERNAME, PASSWORDBasic authentication
    GENERIC_STRINGSECRET_STRINGAn API token or other sensitive string, but never an OAuth token
    OAUTH2 (client credentials)API_AUTHENTICATION, OAUTH_SCOPESOAuth client credentials flow through a security integration
    OAUTH2 (authorization code grant)API_AUTHENTICATION, OAUTH_REFRESH_TOKEN, OAUTH_REFRESH_TOKEN_EXPIRY_TIMEOAuth code grant flow, where a refresh token obtains new access tokens
    CLOUD_PROVIDER_TOKENAPI_AUTHENTICATION, ENABLEDA session with a cloud provider such as AWS, through a cloud provider security integration
    SYMMETRIC_KEYALGORITHM = GENERICA 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.

    An OAuth2 secret backed by a security integrationsql
    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?

    Sources6178

    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.

    A Python UDF that binds a secret under the alias 'cred' and reads it without returning the credentialssql
    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:

    Privileges required at each step of the setup
    StepRole must have
    CREATE NETWORK RULECREATE NETWORK RULE on the schema that will hold the rule
    CREATE SECRETCREATE SECRET on the schema that will hold the secret
    CREATE EXTERNAL ACCESS INTEGRATIONCREATE INTEGRATION on the account, plus USAGE on each secret it uses and on that secret's schema
    CREATE FUNCTION / CREATE PROCEDUREUSAGE 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?

    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.

    Disabling an integration so no handler that relies on it can reach the endpointsql
    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?

    Sources59

    Sources

    (9)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “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. 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. 3.
      “The proxy service can increase security by authenticating requests to the remote service.”
      ↩︎ What an external access integration controls
    4. 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. 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. 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. 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. 8.
      “Gets the username and password from the secret specified by username_password_secret_name.”
      ↩︎ Snowflake secrets and the credentials they hold
    9. 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

    Continue to part 2 of 2

    Egress paths from Snowflake: private connectivity, Data Connectivity Proxy and external functions

    Spotted a mistake, or was something unclear? Tell us.