I'm looking to create a database with access for a single user using the following script:
USE ROLE ACCOUNTADMIN;
CREATE DATABASE db;
USE DATABASE db;
CREATE WAREHOUSE wh
WAREHOUSE_SIZE = SMALL
;
CREATE ROLE new_role;
GRANT USAGE ON DATABASE db TO ROLE new_role;
GRANT CREATE SCHEMA ON DATABASE db TO ROLE new_role;
GRANT ALL ON SCHEMA db.PUBLIC TO ROLE new_role;
CREATE or replace USER new_user PASSWORD='' DEFAULT_ROLE = 'new_role' DEFAULT_WAREHOUSE='wh';
GRANT ROLE new_role TO USER new_user;
GRANT ALL ON WAREHOUSE wh TO new_role;
When attempting to login with the newly created user, or connect from another service, I see the following error:
User's configured default role 'new_role' does not exist or not authorized. Contact your local system administrator, or attempt to login using a CLI client with a connect string selecting another
Setting the default role to PUBLIC
allows me to log in from the Snowflake web portal. I can then select the desired role and navigate as expected. The third party connection cannot access any of the newly created objects, presumably because it does not attempt to switch roles.
What is missing to allow the default role to be set for my new user?