What you will be able to do
- Grant a provider's application roles to account roles so each consumer team gets the right access to the app and its Streamlit UI
- Compare automated granting of privileges (manifest_version 2) with manual grants and references
- Explain how app specifications let consumers approve external endpoints and OAuth connections
- Choose between a consumer-bound SECRET reference and an app-owned OAuth secret for app credentials
1.Application roles decide who in the consumer account can use the app
After installation, a Native App controls access with application roles: roles that exist only inside the application object (the role model is covered in Account roles, database roles, SNOWFLAKE database roles and application roles). The provider creates these roles in the setup script and grants them privileges on the app's objects. A simple app needs nothing beyond them, because the setup script creates all its objects inside the APPLICATION object and manages access through application roles.
GRANT USAGE ON STREAMLIT code_schema.hello_snowflake_streamlit TO APPLICATION ROLE app_public;The consumer works one layer up. Application roles are implicitly granted to the application owner WITH GRANT OPTION, so the consumer admin who owns the app passes each application role to the account roles that should use it. Take an app that exposes viewer and admin, where analysts need the dashboards and only the security team may change configuration. The admin grants viewer to the analysts' account role and admin to the security team's account role. The provider has already decided in the setup script what each role can reach, including whether it can open the Streamlit UI. The consumer's job is only to map those roles to people.
Checkpoint 1 of 6· Check yourself
A consumer installs a simple Native App. All of its objects live inside the APPLICATION object, and it exposes two application roles, viewer and admin. Analysts should see the dashboards, and only the security team should change the configuration. What should the consumer admin who owns the app do?
The provider's setup script already decides what each application role can reach. The consumer's only job is to map those application roles to the right account roles, and they don't grant privileges on the app's objects directly.
“All of the necessary privileges required are managed by the app using application roles.”Source: docs.snowflake.com
Checkpoint 2 of 6· Exam question
A consumer admin has installed a Native App that exposes the application roles viewer and admin. Analysts must use the app's dashboards, while only the security team may change its configuration. What should the admin do?
Correct answer: C — Grant the viewer application role to the analyst account role, and grant the admin application role only to the security team's account role
- A. This is incorrect. Usage on the application object does not expose its internal objects; access to those is controlled by privileges granted to application roles inside the app. It would also not separate viewer from admin duties.
- B. This is incorrect. The app's internal roles are separate from account roles and cannot be granted by consumers. Only application roles the app exposes can be granted to account roles.
- C. This is correct. Application roles are the app's interface to consumers and are granted to account roles to give differentiated access. Granting only
viewerto analysts keeps configuration functions limited to the security team. - D. This is incorrect. IMPORTED PRIVILEGES applies to databases created from shares, not to installed applications. It would not map to the viewer and admin application roles.
2.Automated granting versus consumer-run grants
Some apps need more than the application object: they create a database, or they read a table the consumer already owns. Those actions need privileges granted from the consumer account, and there are two ways to grant them.
Automated granting is turned on by manifest_version: 2. The provider lists the required privileges in the manifest, and Snowflake grants them when the app is installed or upgraded. Snowsight shows a notification of the requested privileges during installation, and that is the consumer's moment to review them. Because upgrades don't ask again, feature policies are how a consumer limits which objects an app can create.
Without automated granting, the consumer has to act. If the provider built a UI with the Python Permission SDK, the consumer approves requests in Snowsight and the SDK runs the GRANT statements. Otherwise, the provider must tell the consumer which SQL to run, ideally in the README shown with the listing. Access to existing consumer objects works through references. The provider names a logical reference in the manifest, and the consumer binds it to a real, fully qualified object. The provider never needs to know the object's actual database or schema name.
Checkpoint 3 of 6· Check yourself
A provider is building an app that must read a sales table the consumer already owns. Each consumer stores that table in a different database and schema, and the provider can't know those names in advance. How should the app get access to the table?
References give the app a logical name for an existing consumer object. The consumer binds that name to the actual fully qualified object after installation, so the provider never needs to know the real database or schema.
“A reference allows a provider to create the app without having to know the specific name of the object or its parent database and schema.”Source: docs.snowflake.com
3.App specifications: consumer approval for external connections
An app specification is how an app asks the consumer to approve a connection that leaves Snowflake. For outbound network access (the integration itself is covered in External access integrations), the app can be granted CREATE EXTERNAL ACCESS INTEGRATION, which lets it create the integration during install or upgrade. The connection details still go to the consumer for approval. The EAI specification lists HOST_PORTS, the host ports from the network rule that the app requires, and PRIVATE_HOST_PORTS for private connectivity to resources outside Snowflake.
The entries in the specification must match the network rule exactly. A port that is left out defaults to 443, but example.com and example.com:443 are still not treated as equal. A specification that lists one form while the network rule holds the other will cause egress to fail.
ALTER APPLICATION SET SPECIFICATION oauth_spec
TYPE = SECURITY_INTEGRATION
LABEL = 'OAuth connection to external provider'
DESCRIPTION = 'Connects to external provider using Authorization Code grant'
OAUTH_TYPE = 'AUTHORIZATION_CODE'
OAUTH_TOKEN_ENDPOINT = 'https://provider.example.com/oauth2/token'
OAUTH_AUTHORIZATION_ENDPOINT = 'https://provider.example.com/oauth2/authorize';Security integrations follow the same rule. An app cannot use a security integration until the consumer has approved the matching specification. Approving one requires the MANAGE APPLICATION SPECIFICATIONS privilege on the account. Declining the specification later is also how the consumer stops the app from using that connection.
Checkpoint 4 of 6· Fill the gap
A provider's app needs an OAuth connection to an external service, and the consumer has to approve it before the app can use it. Which value completes the specification type in this setup-script statement?
ALTER APPLICATION SET SPECIFICATION oauth_spec
TYPE = ?
LABEL = 'OAuth connection to external provider'
DESCRIPTION = 'Connects to external provider using Authorization Code grant'
OAUTH_TYPE = 'AUTHORIZATION_CODE'
OAUTH_TOKEN_ENDPOINT = 'https://provider.example.com/oauth2/token'
OAUTH_AUTHORIZATION_ENDPOINT = 'https://provider.example.com/oauth2/authorize';An OAuth connection runs through a security integration. The app can't use that integration until the consumer approves a matching specification of type SECURITY_INTEGRATION. EXTERNAL_ACCESS describes outbound network access, which is a different kind of specification, and OAUTH2 is a secret type, not a specification type.
Source: docs.snowflake.com4.Keeping third-party keys and OAuth tokens out of app code
Credentials can never be part of the package. Plain-text customer secrets are forbidden, and obfuscated code is rejected, so hiding a key with base64 encoding fails twice. Loading the key from somewhere outside the package breaks the self-containment rule. The two compliant patterns both keep the credential in a Snowflake secret (secret types are covered in Snowflake secrets (password, generic string, OAuth, cloud provider token)). They differ in who owns that secret.
Use a consumer-bound SECRET reference when each consumer has their own API key. The manifest declares a reference with object_type: SECRET and the READ privilege. Each consumer creates a secret in their own account and binds it to the reference. The app's UDF then reads the secret and calls the API through the approved external access integration.
references:
...
- consumer_secret:
label: "Consumer secret"
description: "Needed to authenticate with an external endpoint"
privileges:
- READ
object_type: SECRET
register_callback: config.register_my_secret
configuration_callback: config.get_config_for_refUse an app-owned OAuth secret when the consumer should authorize the app against a third-party service without sharing credentials with the provider (OAuth integrations are covered in SAML2 SSO and OAuth security integrations). The setup script creates an API_AUTHENTICATION security integration and a secret owned by the application. It grants USAGE on the integration and MODIFY on the secret to an application role, then defines a SECRET_AUTHORIZATION configuration. A consumer with that application role approves the integration specification and completes the OAuth consent, in Snowsight, in Streamlit through request_application_configuration_value(), or in SQL with SYSTEM$START_OAUTH_FLOW and SYSTEM$FINISH_OAUTH_FLOW. The tokens land in the secret, which a UDF, procedure or container receives through its SECRETS property.
ALTER APPLICATION SET CONFIGURATION DEFINITION oauth_config
TYPE = SECRET_AUTHORIZATION
SECRET = app_schema.oauth_secret
LABEL = 'Authenticate with external provider'
DESCRIPTION = 'Complete the OAuth flow to connect the app to the external provider'
APPLICATION_ROLES = (app_user);Snowflake refreshes the access token with the stored refresh token. If the refresh token expires or the third party revokes it, external calls fail until the consumer authenticates again. Revocation works differently from what many expect. Running UNSET CONFIGURATION only fires the configuration callbacks and leaves the tokens in the secret. To stop the app using them, decline the security integration specification. To kill the tokens outright, use the third party's own revocation process.
Checkpoint 5 of 6· Match them up
A consumer finished the OAuth flow for an app-owned secret, and the tokens are now stored in that secret. Match each event or action to what it actually does to the app's access.
Tap a term, then the definition that fits it.
Unsetting the configuration only triggers callbacks and does not touch the tokens. Declining the specification stops the app from using them inside Snowflake. Only the third party's revocation process kills the tokens. If the refresh token is lost, the consumer has to authenticate again.
“Unsetting the configuration does not invalidate or revoke the OAuth tokens stored in the secret.”Source: docs.snowflake.com
Checkpoint 6 of 6· Exam question
A provider's Native App calls a third-party REST API that requires an API key. The provider's security reviewer rejects any design that places the key in the application package. Which design satisfies the reviewer while still working for each consumer?
Correct answer: A — Declare a SECRET reference in the manifest so each consumer binds their own secret, then read it in the UDF through the approved external access integration
- A. This is correct. A reference lets the consumer supply and control their own SECRET object, so no credential ships in package files. The function reads the secret at runtime through the approved external access integration.
- B. This is incorrect. Base64 is an encoding and not protection, and the file still ships inside the package that consumers and reviewers can read. Providers are responsible for not placing sensitive data in package files.
- C. This is incorrect. The setup script runs inside the consumer's installation and has no access to the provider's session. A literal in the script is also stored in the package, which is the exact placement the reviewer rejects.
- D. This is incorrect. Snowflake sharing flows from provider to consumer, and the provider cannot read objects in the consumer account or vice versa this way. Sending a shared key to all consumers would also defeat per-consumer credential isolation.
Sources
(7)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“After installing a Snowflake Native App, consumers can grant application roles to account roles to enable access to the app.”
↩︎ Application roles decide who in the consumer account can use the app“Application roles are implicitly granted to the application owner WITH GRANT OPTION.”
↩︎ Application roles decide who in the consumer account can use the app - 2.
“All of the necessary privileges required are managed by the app using application roles.”
↩︎ Application roles decide who in the consumer account can use the app“The Python Permission SDK automatically runs the required GRANT statements in the consumer account.”
↩︎ Automated granting versus consumer-run grants“A reference allows a provider to create the app without having to know the specific name of the object or its parent database and schema.”
↩︎ Checkpoint - 3.
“When a provider configures an app to use manifest_version: 2 in the manifest file, automated granting of privileges is enabled.”
↩︎ Automated granting versus consumer-run grants“During installation, Snowsight displays a notification about the privileges requested by the app.”
↩︎ Automated granting versus consumer-run grants“Consumers can create feature policies that restrict the objects an app can create.”
↩︎ Exam trap 3“they agree that the app may be granted these privileges during upgrades without requiring additional consent.”
↩︎ Prediction - 4.
“When configuring the app, consumers review and approve the host ports and external services.”
↩︎ App specifications: consumer approval for external connections“A mismatch between these values causes egress to fail.”
↩︎ App specifications: consumer approval for external connections“When the port is omitted, it defaults to 443, so example.com and example.com:443 are not considered equivalent.”
↩︎ Exam trap 2 - 5.https://docs.snowflake.com/en/developer-guide/native-apps/app-configuration-secret-authorizationOfficial docs
“Applications can not use security integration without a corresponding approved application specification.”
↩︎ App specifications: consumer approval for external connections“the secret must be owned by the application”
↩︎ Keeping third-party keys and OAuth tokens out of app code“If the refresh token itself expires or is revoked by the third-party provider, external access calls from the app fail”
↩︎ Keeping third-party keys and OAuth tokens out of app code“Unsetting the configuration does not invalidate or revoke the OAuth tokens stored in the secret.”
↩︎ Exam trap 1“Unsetting the configuration does not invalidate or revoke the OAuth tokens stored in the secret.”
↩︎ Checkpoint - 6.
“Apps must not store or require any plain text customer secrets.”
↩︎ Keeping third-party keys and OAuth tokens out of app code - 7.
“object_type: SECRET: Indicates that the reference is a secret.”
↩︎ Keeping third-party keys and OAuth tokens out of app code