Nicolas
Nicolas

Reputation: 89

Get the admin_user from a managed account?

I’m trying to find out the admin_user from a managed account: https://docs.snowflake.com/en/sql-reference/sql/create-managed-account.html

create managed account reader_acct1
  admin_name = user1 , admin_password = 'Sdfed43da!44' ,
  type = reader;

But with the following query, I don’t see the user. Any idea how to get it?

show managed accounts
-- shows the following columns: name, cloud, region, locator, created_on, url, is_reader, comment, region_group

Upvotes: 0

Views: 214

Answers (2)

Nicolas
Nicolas

Reputation: 89

The only way I could find out the user name was to look into the "query_history" view from the snowflake database. With the following query, you get the creation query of the managed account:

select * from snowflake.account_usage.query_history where query_text ilike '%create managed account%' and execution_status = 'SUCCESS';

Upvotes: 1

Nikita Kulkarni
Nikita Kulkarni

Reputation: 61

The user who ran the CREATE MANAGED ACCOUNT command has to be a user with ACCOUNTADMIN role or has MONITOR USAGE privilege.

While, SHOW MANAGED ACCOUNTS does not list the user name who is the admin for a managed account , assuming you are a user with ACCOUNTADMIN privileges since you have access to viewing data returned by SHOW MANAGED ACCOUNTS, query the QUERY_HISTORY view in the SNOWFLAKE.ACCOUNT_USAGE schema and look for the CREATE MANAGED ACCOUNT query text.

Upvotes: 0

Related Questions