What you will be able to do
- Choose the right secret type (OAUTH2, CLOUD_PROVIDER_TOKEN, PASSWORD, GENERIC_STRING) for an external endpoint
- Explain how an OAuth secret uses an API authentication security integration
- Describe how API integrations and proxy services secure external functions
- Pick between public internet, private connectivity and Data Connectivity Proxy for outbound traffic
1.Secrets: one object, four credential shapes
A secret is a schema-level object that holds sensitive information. Access to it is controlled by role-based access control (RBAC), and its contents are encrypted with keys from Snowflake's key encryption hierarchy. Once a secret exists, only specific Snowflake components, such as integrations and external functions, can read its contents. A user who runs DESCRIBE SECRET never sees the stored password.
For external endpoints, choose the TYPE that matches how the endpoint authenticates:
| TYPE | Key properties | Use for |
|---|---|---|
| OAUTH2 | API_AUTHENTICATION plus OAUTH_SCOPES (client credentials) or OAUTH_REFRESH_TOKEN (authorization code grant) | OAuth flows against an external service |
| CLOUD_PROVIDER_TOKEN | API_AUTHENTICATION naming a cloud provider security integration, ENABLED | Authenticating to a cloud provider such as AWS |
| PASSWORD | USERNAME, PASSWORD | Basic authentication |
| GENERIC_STRING | SECRET_STRING | An API token or other sensitive string read by handler code; never an OAuth token |
CREATE [ OR REPLACE ] SECRET [ IF NOT EXISTS ] <name>
TYPE = PASSWORD
USERNAME = '<username>'
PASSWORD = '<password>'
[ COMMENT = '<string_literal>' ]Checkpoint 1 of 8· Fill the gap
The vendor issues a plain API key. Which secret type completes this statement?
CREATE OR REPLACE SECRET bp_maps_api
TYPE = ?
SECRET_STRING = 'replace-with-your-api-key';SECRET_STRING belongs to the GENERIC_STRING type, which Snowflake suggests when an API key is the only credential.
Source: docs.snowflake.comCheckpoint 2 of 8· Match them up
Match each secret type to what it stores
Tap a term, then the definition that fits it.
Each type comes with its own required properties. Picking the type that matches the endpoint's authentication method is what makes the secret usable.
“Specifies that this is a secret for use with a cloud provider, such as Amazon Web Services (AWS).”Source: docs.snowflake.com
Sources1
2.API authentication integrations behind OAuth secrets
For external API authentication, Snowflake supports three methods: basic authentication, OAuth with the authorization code grant flow, and OAuth with the client credentials flow. Basic authentication only needs a PASSWORD secret. The OAuth flows also need a security integration for external API authentication. It holds the values the OAuth flow requires, such as the client ID, client secret and token endpoint. An OAUTH2 secret points to that security integration through API_AUTHENTICATION. Snowflake calls this pattern a best practice for OAuth endpoints.
The two OAuth flows use different secret properties. In the authorization code grant flow, the secret stores OAUTH_REFRESH_TOKEN, which is used to get a new access token when the current one expires, along with its expiry time. In the client credentials flow, the secret can set OAUTH_SCOPES. These scopes must be a subset of the OAUTH_ALLOWED_SCOPES defined on the security integration.
CREATE OR REPLACE SECRET oauth_token
TYPE = OAUTH2
API_AUTHENTICATION = google_translate_oauth
OAUTH_REFRESH_TOKEN = 'my-refresh-token';In handler code, a Python UDF gets the token with _snowflake.get_oauth_access_token('cred'). Here 'cred' is the name that the function's SECRETS clause binds to the secret, so the token value never appears in the code. This setup also supports separation of duties. One team manages the secret. The roles that use a connector need only the secret's name and never see what it contains.
Checkpoint 3 of 8· Check yourself
What does Snowflake recommend for an external endpoint that supports OAuth?
An OAUTH2 secret that references a security integration lets Snowflake handle the OAuth flow. GENERIC_STRING must not hold OAuth tokens.
“a best practice is to have your secret contain a reference to a security integration that contains values needed for OAuth flow”Source: docs.snowflake.com
3.External functions: API integrations and proxy services
An external function is the other way to reach outside code from SQL. Unlike a UDF that uses an external access integration, it has no handler code of its own. It calls a remote service that runs outside Snowflake, such as an AWS Lambda function. Snowflake never calls that remote service directly. It sends the request to a cloud provider's proxy service, such as Amazon API Gateway, which passes it on. The security information is stored in an API integration, created with CREATE API INTEGRATION. Creating one requires ACCOUNTADMIN or a role with CREATE INTEGRATION. The author of the function needs USAGE on the API integration.
| Aspect | UDF/procedure with external access integration | External function |
|---|---|---|
| Where the code runs | Handler code inside Snowflake | Remote service outside Snowflake |
| Object holding security settings | External access integration (network rules and secrets) | API integration |
| What Snowflake connects to | The endpoint named in an EGRESS network rule | A proxy service such as Amazon API Gateway |
| Created with | CREATE EXTERNAL ACCESS INTEGRATION | CREATE API INTEGRATION |
API integrations do not store credentials. Instead, the administrator sets up a trust policy that uses the cloud provider's own authentication. On AWS, you edit the IAM role's trust relationship: set Statement.Principal.AWS to the integration's API_AWS_IAM_USER_ARN, and add a StringEquals condition on sts:ExternalId set to its API_AWS_EXTERNAL_ID.
The integration's API_ALLOWED_PREFIXES lists the proxy endpoints that functions may call, and you should keep that list as narrow as you can. Unless the function is meant to be public, protect the proxy too. Require AWS_IAM authorization on the method and restrict the API Gateway with a resource policy. An optional API_KEY adds a subscription key, but it does not replace IAM.
Checkpoint 4 of 8· Check yourself
When a query calls an external function, where does Snowflake send the HTTP POST?
External functions always go through a proxy service such as Amazon API Gateway. EGRESS network rules belong to external access integrations.
“Snowflake does not call a remote service directly. Instead, Snowflake calls a proxy service, which relays the data to the remote service.”Source: docs.snowflake.com
Checkpoint 5 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 6 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.
4.Egress paths: public internet, private connectivity and Data Connectivity Proxy
Each external route has to cross a network. By default it uses the public internet. For stricter requirements, outbound traffic can instead use private connectivity: Azure Private Link, AWS PrivateLink or Google Cloud Private Service Connect. This applies to external access integrations, external functions, external stages and other features. It has three conditions: the account must be Business Critical Edition or higher, the person configuring it must have ACCOUNTADMIN, and there are extra charges for each endpoint and for the total data processed. In the network rule, TYPE = PRIVATE_HOST_PORT replaces HOST_PORT.
Checkpoint 7 of 8· Check yourself
A team on Enterprise Edition wants an external access integration to reach a vendor over AWS PrivateLink. What blocks them?
Outbound private connectivity requires Business Critical Edition or higher. It is also configured with ACCOUNTADMIN and billed separately.
“If you choose to use private connectivity, your Snowflake account must be Business Critical Edition (or later).”Source: docs.snowflake.com
Some private sources cannot be reached through a cloud-provider private endpoint: on-premises systems, cross-cloud sources and sources not native to a cloud provider. For these, Snowflake offers Data Connectivity Proxy. You add a network rule with MODE = DATA_CONNECTIVITY_PROXY_EGRESS to the integration. Then you attach the integration to the proxy object with EXTERNAL_ACCESS_INTEGRATIONS on CREATE DATA CONNECTIVITY PROXY or ALTER DATA CONNECTIVITY PROXY. The provided sources go no further than that, and Snowflake's setup procedure is documented separately.
Checkpoint 8 of 8· Check yourself
Which network rule mode sends an integration's traffic through Data Connectivity Proxy?
Data Connectivity Proxy routing uses its own mode. PRIVATE_HOST_PORT is a TYPE value for cloud private connectivity, not a mode.
“include a network rule with MODE = DATA_CONNECTIVITY_PROXY_EGRESS in the integration”Source: docs.snowflake.com
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.An OAuth access or refresh token can go in a GENERIC_STRING secret because it is just a string.Why is that wrong?
Snowflake says GENERIC_STRING must not hold any kind of OAuth token. Use an OAUTH2 secret that references a security integration.
Covered in Secrets: one object, four credential shapes
2.Adding an API_KEY to an API integration secures the proxy, so IAM authorization can be skipped.Why is that wrong?
An API key (subscription key) is an extra layer on top of IAM, not a replacement. Keep AWS_IAM authorization and a resource policy on the proxy.
Covered in External functions: API integrations and proxy services
Practise it for real
Give a Python UDF access to one external API host and confirm that every other host is blocked
1.Create a network rule with MODE = EGRESS, TYPE = HOST_PORT and VALUE_LIST set to the vendor's host.
Why: The rule names the one location the handler will be allowed to reach.
You should see: The rule exists in your security schema; no port given means 443.
2.Create a secret whose TYPE matches the vendor's authentication: OAUTH2 with API_AUTHENTICATION for OAuth, GENERIC_STRING for an API key.
Why: Credentials live in an encrypted, RBAC-controlled object, not in handler code.
You should see: DESCRIBE SECRET shows the secret's metadata, not its value.
3.Run CREATE EXTERNAL ACCESS INTEGRATION with ALLOWED_NETWORK_RULES and ALLOWED_AUTHENTICATION_SECRETS listing your rule and secret, and ENABLED = true.
Why: The integration is the allowlist that functions will reference.
You should see: Succeeds only for a role with CREATE INTEGRATION and USAGE on the secret and its schema.
4.As the developer role (USAGE on the integration, READ on the secret), create the UDF with EXTERNAL_ACCESS_INTEGRATIONS and SECRETS clauses.
Why: The function opts in to the integration and binds the secret to a name the handler uses.
You should see: Calls to the allowed host succeed; calls to any other host are denied.
5.Query the EXTERNAL_ACCESS_HISTORY view.
Why: Administrators monitor outbound requests here.
You should see: Your UDF's requests to the external location are recorded.
Stuck? Get a nudge
If CREATE FUNCTION fails on the secret, check for READ on the secret, not just USAGE.
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“A secret is a schema-level object that stores sensitive information, limits access to the sensitive information using RBAC”
↩︎ Secrets: one object, four credential shapes“if a user runs a DESCRIBE SECRET operation on the secret, the password value stored in the secret is never exposed.”
↩︎ Secrets: one object, four credential shapes“A security integration for external API authentication enables Snowflake to connect to the service hosted outside of Snowflake when using the OAuth flows.”
↩︎ API authentication integrations behind OAuth secrets“the users granted the connector roles do not need to view the sensitive information stored in the secret”
↩︎ API authentication integrations behind OAuth secrets - 2.
“used to obtain a new access token from the OAuth authorization server when the access token expires”
↩︎ API authentication integrations behind OAuth secrets“You should not use this property to store any kind of OAuth token”
↩︎ Exam trap 1“Specifies that this is a secret for use with a cloud provider, such as Amazon Web Services (AWS).”
↩︎ Checkpoint“If the OAUTH_SCOPES property values are not specified, the secret inherits all of the scopes that are specified in the security integration.”
↩︎ Prediction - 3.
“Snowflake stores security-related external function information in an API integration.”
↩︎ External functions: API integrations and proxy services“Snowflake does not call a remote service directly. Instead, Snowflake calls a proxy service, which relays the data to the remote service.”
↩︎ Checkpoint - 4.
“the author of the external function must be granted USAGE privilege on the API integration.”
↩︎ External functions: API integrations and proxy services“the administrator can also specify an allowed list of endpoints that the API integration object can access”
↩︎ External functions: API integrations and proxy services“Unless your external function is intended to be publicly accessible, Snowflake strongly recommends securing your proxy service endpoints.”
↩︎ External functions: API integrations and proxy services“Restrict access to your API Gateway endpoints by adding a resource policy.”
↩︎ External functions: API integrations and proxy services“An API_KEY is in addition to, not a substitute for, IAM (Identity and Access Management).”
↩︎ Exam trap 2 - 5.
“To maximize security, you should restrict allowed locations as narrowly as practical.”
↩︎ External functions: API integrations and proxy services - 6.https://docs.snowflake.com/en/sql-reference/external-functions-creating-aws-common-api-integration-proxy-linkOfficial docs
“find the Statement.Principal.AWS field and replace the value (not the key) with the value in the API_AWS_IAM_USER_ARN field of the worksheet.”
↩︎ External functions: API integrations and proxy services - 7.https://docs.snowflake.com/en/developer-guide/external-network-access/creating-using-external-network-accessOfficial docs
“If you use private connectivity, the person configuring the interaction must have been assigned the ACCOUNTADMIN role.”
↩︎ Egress paths: public internet, private connectivity and Data Connectivity Proxy“a best practice is to have your secret contain a reference to a security integration that contains values needed for OAuth flow”
↩︎ Checkpoint“include a network rule with MODE = DATA_CONNECTIVITY_PROXY_EGRESS in the integration”
↩︎ Checkpoint - 8.
“You pay for each private connectivity endpoint along with total data processed.”
↩︎ Egress paths: public internet, private connectivity and Data Connectivity Proxy - 9.https://docs.snowflake.com/en/developer-guide/external-network-access/external-network-access-overviewOfficial docs
“For data sources that aren’t accessible through a cloud-provider private endpoint (on-premises, cross-cloud, or non-CSP-native sources), use Data Connectivity Proxy.”
↩︎ Egress paths: public internet, private connectivity and Data Connectivity Proxy“If you choose to use private connectivity, your Snowflake account must be Business Critical Edition (or later).”
↩︎ Checkpoint