CREATE EXTERNAL ACCESS INTEGRATION
statementpartialIntegrations, network & secretsCreates an external access integration for access to external network locations from a UDF or procedure handler. This command supports the following variants: - CREATE OR ALTER EXTERNAL ACCESS INTEGRATION: Creates an external access integration if it doesn’t exist or alters an existing external access integration. (Public Preview) - DEFINE EXTERNAL ACCESS INTEGRATION: Declarative definition of an external access integration’s target state inside a DCM project. (Public Preview)
Syntax
supportedpartialnot supportednot scored
CREATE [ OR REPLACE ] EXTERNAL ACCESS INTEGRATION <name>
[ ALLOWED_NETWORK_RULES = ( <rule_name_1> [, <rule_name_2>, ... ] ) ]
[ ALLOWED_HTTP_RULES = ( <http_rule_name_1> [, <http_rule_name_2>, ... ] ) ]
[ ALLOWED_API_AUTHENTICATION_INTEGRATIONS = { ( <integration_name_1> [, <integration_name_2>, ... ] ) | none } ]
[ ALLOWED_AUTHENTICATION_SECRETS = { ( <secret_name_1> [, <secret_name_2>, ... ] ) | all | none } ]
ENABLED = { TRUE | FALSE }
[ COMMENT = '<string_literal>' ]
Parameters
| Name | Required | Description |
|---|---|---|
name | required | Identifier for the external access integration. The identifier value must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (e.g. "My object"). Identifiers enclosed in double quotes are case-sensitive. For more details, see Identifier requirements. |
ALLOWED_NETWORK_RULES = (rule_name [ , rule_name ... ]) | required | Specifies the allowed network rules. Only egress rules may be specified. Required unless you specify ALLOWED_HTTP_RULES. You can specify both. |
ENABLED = { TRUE | FALSE } | required | Specifies whether this integration is enabled or disabled. If the integration is disabled, any handler code that relies on it will be unable to reach the external network location. The value is case-insensitive. The default is TRUE. |
ALLOWED_HTTP_RULES = ( http_rule_name [ , http_rule_name ... ] ) | optional | Specifies the allowed HTTP rules, which allow requests by destination, method, and path. HTTP rules are in preview and apply only in Cortex Code cloud sandboxes; UDFs, procedures, and other features that use the integration ignore them. Required unless you specify ALLOWED_NETWORK_RULES. You can specify at most 32 HTTP rules. |
ALLOWED_API_AUTHENTICATION_INTEGRATIONS = ( integration_name_1 [, integration_name_2, ... ] ) | none | optional | Specifies the security integrations whose OAuth authorization server issued the secret used by the UDF or procedure. The security integration must be the type used for external API integration. This parameter’s value must be one of the following: One or more Snowflake security integration names to allow any of the listed integrations. none to allow no integrations. Security integrations specified by this parameter – as well as secrets specified by the ALLOWED_AUTHENTICATION_SECRETS parameter – are ways to allow secrets for use in a UDF or procedure that uses this external access integration. For more information, see Usage notes. For reference information about security integrations, refer to CREATE SECURITY INTEGRATION (External API Authentication). |
ALLOWED_AUTHENTICATION_SECRETS = ( secret_name [, secret_name ... ] ) | all | none | optional | Specifies the secrets that UDF or procedure handler code can use when accessing the external network locations referenced in allowed network rules. This parameter’s value must be one of the following: One or more Snowflake secret names to allow any of the listed secrets. all to allow any secret. none to allow no secrets. The ALLOWED_API_AUTHENTICATION_INTEGRATIONS parameter can also specify allowed secrets. For more information, see Usage notes. For reference information about secrets, refer to CREATE SECRET. |
COMMENT = 'string_literal' | optional | Specifies a comment for the external access integration. Default: No value |
Usage notes
- The role that creates the integration must have the owner role of each referenced network rule in its role hierarchy. If it doesn’t, the CREATE statement succeeds, but users of the integration later get an error about a missing privilege on the network rule. For example, suppose the network_admin role owns a network rule and isn’t granted to accountadmin. If accountadmin creates an integration that references the rule and grants USAGE on the integration to the dev role, dev can’t use the integration. For more information, see Access control and Error: Insufficient privileges on network rule.
- You can allow secrets for use by a UDF or procedure by using two external access integration parameters, as described below. With the ALLOWED_AUTHENTICATION_SECRETS parameter. You can specify secrets as parameter values or set the parameter’s value to all, allowing handler code to use any secret.
- With the ALLOWED_API_AUTHENTICATION_INTEGRATIONS parameter. A secret is allowed for use when the secret itself specifies a security integration whose name is also specified by this parameter. The secret specifies the security integration with its API_AUTHENTICATION parameter. In other words, when both the secret and the external access integration specify the security integration, the secret is allowed for use in functions and procedures that specify the external access integration.
- Note that these two alternatives function independently of one another. A secret is allowed if either (or both) of the parameters allows it, regardless of the value specified for the other parameter. For example, setting one of the parameters to none does not prevent a secret specified by the other parameter from being used in handler code.
- While you can specify network rules using a hostname, Snowflake enforces network rules at the IP level of granularity. For network rules, 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 and that it is not possible to connect to other services on the same host. Whenever possible, you should use secure protocols such as HTTPS and TLS when communicating with internet endpoints.
- HTTP rules apply only in Cortex Code cloud sandboxes. In a sandbox, a request is allowed if any of the integration’s network rules or HTTP rules allows it. An HTTP rule allows only the methods and paths it names, so it can’t narrow what a network rule for the same host allows.
- Regarding metadata: Attention Customers should ensure that no personal data (other than for a User object), sensitive data, export-controlled data, or other regulated data is entered as metadata when using the Snowflake service. For more information, see Metadata fields in Snowflake.
- CREATE OR REPLACE <object> statements are atomic. That is, when an object is replaced, the old object is deleted and the new object is created in a single transaction.
Access control requirements
A role used to execute this operation must have the following privileges at a minimum: Privilege | Object | Notes CREATE INTEGRATION | Account | Only the ACCOUNTADMIN role has this privilege by default. The privilege can be granted to additional roles as needed. USAGE | Secret | Required for all secrets referenced by the integration. USAGE | HTTP rule | Required for all HTTP rules referenced by the integration. USAGE | Schema | Required for all schemas containing any secrets referenced by the integration. CREATE EXTERNAL ACCESS INTEGRATION | Account | Grants the ability to create external access integrations. This privilege does not grant the ability to create other types of integrations. OWNERSHIP | External access integration | Required only when executing a CREATE OR ALTER EXTERNAL ACCESS INTEGRATION statement for an existing external access integration. For instructions on creating a custom role with a specified set of privileges, see Creating custom roles. For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.
CREATE OR ALTER EXTERNAL ACCESS INTEGRATION usage notes
- All limitations of the ALTER EXTERNAL ACCESS INTEGRATION command apply.
Known gaps
- ALLOWED_HTTP_RULES is not exercised by any test