CREATE FEATURE POLICY
statementsupportedGovernance (policies, tags, data quality)Creates a new feature policy. Feature policies can be applied to all databases or a specific database, to all personal databases, or to all native apps or a specific application. For an overview, see Feature policies.
Syntax
supportedpartialnot supportednot scored
CREATE [ OR REPLACE ] FEATURE POLICY [ IF NOT EXISTS ] <name>
[ BLOCKED_OBJECT_TYPES_FOR_CREATION = ( <type> [ , ... ] ) ]
[ COMMENT = '<string-literal>' ]
[ AS $$
<yaml-body>
$$ ]
Parameters
| Name | Required | Description |
|---|---|---|
name | Specifies the identifier for the feature policy. In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (for example, "My object"). Identifiers enclosed in double quotes are also case-sensitive. For more information, see Identifier requirements. | |
BLOCKED_OBJECT_TYPES_FOR_CREATION = ( type [ , ... ] ) | Specifies a list of objects that can’t be created. The following objects can be blocked: AGENTS APPLICATION_SERVICE ARTIFACT_REPOSITORY COMPUTE_POOLS CORTEX_SEARCH_SERVICES DATABASES DYNAMIC_TABLES FILE_FORMATS FUNCTIONS GIT_REPOSITORY ICEBERG_TABLES MATERIALIZED_VIEWS MCP_SERVERS PROCEDURES SCHEMA SECRET STAGES TABLES TASKS VIEWS WAREHOUSES WORKSPACE Each type is accepted in either singular or plural form (for example, both TABLE and TABLES). Note Account-level object types have no effect when a feature policy is bound to personal databases. They apply only in a native app context. APPLICATION_SERVICE and ARTIFACT_REPOSITORY are used with Snowflake App Runtime. Attach a policy that blocks these types to all personal databases to prevent users from creating App Runtime apps in their personal databases. For details, see Restrict app creation in personal databases. | |
COMMENT = 'string_literal' | String (literal) that specifies a comment for the feature policy. Default: No value | |
AS $$ ... $$ | Optional YAML body that defines conditional creation rules. The body can include blocked_creation_rules and an optional conditions list. Each rule can include an optional error_message that Snowflake shows to the user when the rule blocks a statement. For more information, see Custom error messages. For syntax, supported object types, and examples, see Feature policy rules. |
Usage notes
- If a policy is bound to an object, for example an account or an app, the policy can’t be replaced. Use the ALTER FEATURE POLICY to update or rename the feature policy.
- This command does not support using the CLONE clause to create a copy of a feature policy.
- Specify BLOCKED_OBJECT_TYPES_FOR_CREATION, an AS body, or both. You can use them together in a single policy.
Access control requirements
A role used to execute this operation must have the following privileges at a minimum: Privilege | Object | Notes CREATE FEATURE POLICY | SCHEMA | Grants the ability to create feature policies. You must have this privilege set on the schema containing the policy to be created. Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema. 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.