CREATE RESTRICTED SESSION SCOPE

statementsupportedAccess control (grants, roles)

docs.snowflake.com ↗

Object: RESTRICTED SESSION SCOPE

Creates a new restricted session scope (RSS). RSS is a shorthand alias for RESTRICTED SESSION SCOPE. You can use either form in this statement. An RSS is a YAML privilege ceiling that limits what an agent can do on behalf of a user. After you create the object, reference it from a session policy with AGENT_RESTRICTED_SESSION_SCOPE. This command supports the following variants: - CREATE OR ALTER RESTRICTED SESSION SCOPE: Creates a restricted session scope if it doesn’t exist, or replaces the definition of an existing restricted session scope. Use this variant to replace a definition: CREATE RESTRICTED SESSION SCOPE doesn’t support an OR REPLACE clause.

Syntax

supportedpartialnot supportednot scored

CREATE { RESTRICTED SESSION SCOPE | RSS } [ IF NOT EXISTS ] <name>
  [ COMMENT = '<string_literal>' ]
  AS $$
    <yaml_definition>
  $$

Creates a new restricted session scope if it doesn’t already exist, or replaces the YAML definition of an existing restricted session scope.

CREATE OR ALTER { RESTRICTED SESSION SCOPE | RSS } <name>
  [ COMMENT = '<string_literal>' ]
  AS $$
    <yaml_definition>
  $$

Parameters

NameRequiredDescription
namerequiredString that specifies the identifier for the restricted session scope; must be unique for the schema in which the object is created. 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.
AS $$ yaml_definition $$requiredYAML document that defines the privilege ceiling. The document has two top-level sections: privilege_scopes (allowed operations and the containers they apply to) and role_scopes (roles that can be activated while an agent is active). For the YAML structure, predefined scopes, and group privileges, see Restricted Session Scope for agents.
COMMENT = 'string_literal'optionalAdds a comment or overwrites an existing comment for the restricted session scope.

Usage notes

Access control requirements

A role used to execute this operation must have the following privileges at a minimum: Privilege | Object CREATE RESTRICTED SESSION SCOPE | Schema 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.

See also

Referenced by