You are creating a Snowflake Native Application that will be distributed to consumer accounts. As part of the installation process, you need to ensure that a specific database role, 'DATA READER, is created in the consumer account and granted 'SELECT' privileges on a specific table in the consumer's shared dat a. Which of the following code snippets, when placed within the application's setup script (install.sql), will correctly achieve this, assuming the application is granted 'CREATE DATABASE ROLE?
Correct Answer: D
Option D correctly creates the database role, grants the necessary privileges, and associates it with the application. Here's a breakdown: 'CREATE OR REPLACE DATABASE ROLE DATA_READER;': creates or replaces the database role 'DATA_READER in the consumer account. 'GRANT SELECT ON TABLE CONSUMER DB.PUBLIC.MY TABLE TO DATABASE ROLE DATA READER;': Grants the 'SELECT privilege on the specified table to the 'DATA_READER role. It assumes that already exists in the consumer account through data sharing or some other mechanism. 'GRANT DATABASE ROLE DATA READER TO APPLICATION ROLE app_public;': This grants the database role to the application role, making the database role available to the application via the 'app_public' application role. 'GRANT APPLICATION ROLE app_public TO APPLICATION This is essential. This makes sure the application has the privileges from the application role granted. Without this, the database role is effectively useless to the application. In the consumer account, this means it will be able to use application. It should have an application object representing installed app in Consumer Account. Option A is incorrect because granting to 'SHARE is not the appropriate way to grant the role to the application. This is meant for granting to other accounts. Option B is incorrect because application will not be able to use app_public if not granted. Option C is incorrect because you need to assign database role to application role so it can be properly managed at the application level. You also need to grant the application role to the applicatiom Option E is incorrect because you should not grant the application role to SHARE; it will provide access to any accounts using the share, and can lead to over-privileged access.
Question 62
You are developing a Snowflake Native Application that utilizes Snowpark Container Services to perform complex image processing. The application needs to securely access data stored in the consumer's Snowflake account, specifically a table named 'USER IMAGES' in the schema 'RAW DATA'. The container image is built and pushed to Snowflake's internal registry. Which of the following steps are necessary to ensure the container service can access this data securely and efficiently within the consumer's account without exposing credentials directly in the container environment?
Correct Answer: D
The most secure and efficient way to grant access is to use database roles and entitlements. Creating a database role with the required privileges, assigning it to the service account of the container service through an entitlement provided to consumer is the recommended approach. This avoids storing credentials directly and provides fine-grained access control. Using SNOWFLAKE_CONTAINER_SERVICE role is too broad and admin credentials should never be used directly in the code. Storing service account credentials in environment variables is insecure. OAuth is not directly used for container services accessing data within the consumer's account in this manner; entitlements offer a more streamlined and secure approach. Network Rules control egress traffic, not access to Snowflake data within the account.
Question 63
You are developing a Snowflake Native Application that offers a data anonymization service to consumers using Snowpark Container Services. The service accepts a dataset from the consumer's Snowflake account, performs anonymization within the container, and then writes the anonymized data back to a new table in the consumer's account. Which of the following is a correct and secure combination of actions required to successfully achieve this data transfer, assuming the container is already built and pushed to Snowflake's registry? (Select all that apply)
Correct Answer: C,E
To enable data transfer from the consumer's account to the container service and back, several steps are crucial: C: Correct. The consumer needs to grant CREATE TABLE privilege using an entitlement, specifically to the service account associated with the Snowpark Container Service within the Native App, for the database where the anonymized data will be writtem This ensures the application can create the new table. E: Correct. Snowflake's internal APIs provide a secure and managed way for the container service to authenticate and authorize against the consumer's Snowflake account. Database roles and entitlements are key for managing these permissions. Roles are assigned to the container's service account, enabling it to perform actions with the necessary privileges. A: Incorrect . IMPORTED PRIVILEGES grant access to objects within the provider's (application developer) account, not objects within the consumer's account. B: Incorrect. While the consumer may grant USAGE on the database, this doesn't give specific access to the table. SELECT privileges would be required for the application to read the data from the specified table. D: Incorrect. Creating stages programmatically within the consumer's account is not a standard or recommended part of Native Apps. Stages are generally managed separately and access is granted via roles and privileges.
Question 64
You are developing a Snowflake Native Application that needs to securely access data in a consumer's account. The application requires the consumer to grant specific privileges to a custom role created and managed within the application package. Which of the following steps are absolutely essential for correctly configuring the application package to ensure this secure data access, and how should the setup script handle the privilege granting?
Correct Answer: B
Option B is correct because it outlines the necessary steps for secure data access in a Snowflake Native Application. The application package manifest informs Snowflake about the app's requirements. The setup script handles granting privileges using EXECUTE IMMEDIATE' because the application role doesn't exist in the consumer account until installation. Options A, C, D, and E are incorrect because they either describe insecure practices, inaccurate assumptions about application capabilities, or fail to address the secure granting of privileges to the application's role within the consumer's environment. Shares are not used to grant privileges to roles in the consumer account; privileges must be granted directly. Consumers are not typically required to manually grant privileges. Service accounts are not a supported method. 'USAGE' does not provide read access to the tables.
Question 65
You are developing a Snowflake Native Application that needs to be deployed across multiple consumer accounts. The application relies on a secure external function (SEF) for real-time data enrichment. The SEF interacts with a third-party API secured with OAuth 2.0. What are the MOST important considerations when designing the setup script for this application to ensure seamless deployment and security in the consumer accounts?
Correct Answer: C,E
Options C and E are the most secure and practical. Option C gives the consumer full control of the OAuth credentials. Option E uses secure secret objects, providing a way for consumers to inject their credentials post-installation without exposing them directly in the setup script, adhering to the principle of least privilege and enhancing security. Options A and B represent poor security practice. Option D is unreliable.