GRANT APPLICATION ROLE

statementsupportedAccess control (grants, roles)

docs.snowflake.com ↗

Assigns an application role to an account role, another application role, an application, or a user. This command creates a “parent-child” relationship between the application role and the role to which it is granted, also referred to as a role hierarchy. For more details, see Overview of Access Control. The Snowflake Native App Framework is generally available on supported cloud platforms. For additional information, see Support for private connectivity, VPS, and government regions.

Syntax

supportedpartialnot supportednot scored

GRANT APPLICATION ROLE <name> TO ROLE <parent_role_name> [ WITH GRANT OPTION ]

GRANT APPLICATION ROLE <name> TO { APPLICATION ROLE <application_role> | APPLICATION <application_name> | USER <user_name> }

Parameters

NameRequiredDescription
nameSpecifies the identifier for the application role to grant. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.
ROLE parent_role_nameGrants the application role to the specified account role.
APPLICATION ROLE application_roleGrants the application role to the specified application role in the same application. This grant creates a role hierarchy of application roles. If the identifier isn’t fully qualified in the form of application_name.application_role_name, the command looks for the application role in the current application for the session.
APPLICATION application_nameGrants the application role to the specified application.
USER user_nameGrants the application role to the specified user.
WITH GRANT OPTIONIf specified, allows the recipient account role to grant the application role further. The recipient can include WITH GRANT OPTION on those grants. Default: No value, which means the recipient account role can’t grant the application role further. The recipient still inherits the privileges of the granted application role. Application roles are granted to the application owner with WITH GRANT OPTION. The application owner can grant an application role to another account role with WITH GRANT OPTION. That grantee can then grant the application role further. WITH GRANT OPTION applies when the grantor is an account role, including the application owner. It doesn’t apply when the application grants an application role to another application role in the same application. For revoke behavior, see REVOKE APPLICATION ROLE.

Usage notes

Access control requirements

A role used to execute this operation must have the following privileges at a minimum: The following table lists two different grantors. The application owner grants an application role outside the application, and the application grants an application role to another application role in the same application: Privilege or role | Object | Notes OWNERSHIP | Application | The application owner can grant an application role to an account role, another application, or a user. A grant to an account role can include WITH GRANT OPTION. A role that was granted the application role with WITH GRANT OPTION can also grant it to an account role, another application, or a user. OWNERSHIP | Application role | The application can grant an application role to another application role in the same application. This grant forms the application role hierarchy. Only the application owner, or a role that was granted the application role with WITH GRANT OPTION, can grant an application role to an account role, another application, or a user. The MANAGE GRANTS privilege doesn’t apply to these grants. ACCOUNTADMIN can grant an application role only when it owns the application or was granted the application role with WITH GRANT OPTION. For example, ACCOUNTADMIN doesn’t own the SNOWFLAKE application, but it has the SNOWFLAKE application roles with WITH GRANT OPTION, so it can grant them to other roles. 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