Is it possible to list all of the roles that a user has access to in Snowflake DB?
I seem to be able to show the users with access to a role but I can't figure out how to list the roles a user is granted. Of course I can crawl the roles and work at it from that angle, but it would be very beneficial to do the opposite.
Lists all the roles which you can view across your entire account, including the system-defined roles and any custom roles that exist. Snowflake allows users to list roles; however, the ability to list roles is not the same as using any role. Knowing the names of roles does not allow any additional access.
Returns the name of the primary role in use for the current session. To specify a different role for the session, execute the USE ROLE command.
The SYSADMIN role is a system-defined role that has privileges to create warehouses, databases, and database objects in an account and grant those privileges to other roles. In the default system hierarchy, the top-level ACCOUNTADMIN role manages the system administrator role.
The roles must be granted to the user before they can be activated in a session. Note that while a session must have exactly one active primary role at a time, one can activate any number of secondary roles at the same time.
It turns out that:
show grants to user <user-name>;
Actually lists the roles of the user very trivially. I had tried this before and miss-read the output and ended up wasting a lot of time looking for alternatives.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With