Module 05 · Lesson 11 of 15Detailed study · about 20 min

Google Cloud Storage: grant the generated identity

A GCS integration identifies a Snowflake-managed service account. Your cloud administrator grants that identity access to the chosen bucket.

Understand the idea

Create the integration first, then read STORAGE_GCP_SERVICE_ACCOUNT from DESC. Do not create an unrelated service account and assume Snowflake will use it. Use a dedicated lab bucket so the cloud permission scope is easy to reason about.

Key ideas in simple English
ConceptWhat it means
gcs://The location scheme used in Snowflake stage definitions for GCS.
Service accountThe principal returned by DESC INTEGRATION.
Bucket IAMThe cloud permissions that allow listing and reading.

A concrete example

Give the returned STORAGE_GCP_SERVICE_ACCOUNT to the cloud administrator for the bucket grant. Stage URLs use gcs:// even though some Google tools use gs://.

Remember: Bind cloud access to the exact generated identity, then verify actual file access.

Explain it step by step · full theory

Understand the idea

Create the integration first, then read STORAGE_GCP_SERVICE_ACCOUNT from DESC. Do not create an unrelated service account and assume Snowflake will use it. Use a dedicated lab bucket so the cloud permission scope is easy to reason about.

For read-only loading, the provider guide calls for storage.buckets.get, storage.objects.get and storage.objects.list. An administrator can create an appropriate custom role and bind it to the returned principal on the lab bucket. Organization policies or customer-managed encryption can require additional approved configuration.

Follow the workflow

The Snowflake allowlist is not a GCS IAM grant. Restrict the stage location to incoming/ and keep private/ excluded. If cloud IAM gives wider bucket access, document that separately rather than claiming the allowlist changed the cloud role.

After the cloud grant, create the stage and use the final lab’s list/read checks. An empty list may simply mean the file has not been uploaded; an authorization error needs an identity and permission investigation.

Words used in this lesson
gcs://
The location scheme used in Snowflake stage definitions for GCS.
Service account
The principal returned by DESC INTEGRATION.
Bucket IAM
The cloud permissions that allow listing and reading.

See how it works

Choose a step to explore the idea at your own pace.

Open the interactive explanation
Interactive explainer1 / 3

Google Cloud Storage: grant the generated identity

Source files
Storage location

Locate the data

A GCS integration identifies a Snowflake-managed service account. Your cloud administrator grants that identity access to the chosen bucket.

Automatic playback is off for reduced motion. Select any step or use Previous and Next. Illustrations explain behavior; they are not live measurements.

Read the complete diagram explanation
  1. Locate the data

    A GCS integration identifies a Snowflake-managed service account. Your cloud administrator grants that identity access to the chosen bucket.

  2. Configure the boundary

    Create the integration first, then read STORAGE_GCP_SERVICE_ACCOUNT from DESC. Do not create an unrelated service account and assume Snowflake will use it. Use a dedicated lab bucket so the cloud permission scope is easy to reason about.

  3. Observe the outcome

    Bind cloud access to the exact generated identity, then verify actual file access.

Try the SQL or command

Read → predict → run in your learning environment → compare. You can also learn by reading without an account.

New to SQL? Where to run it and how to read it

A query is a question written in SQL. Snowflake runs it and returns a result table. This website shows examples; it does not connect to your account.

  1. No account yet? Read and predict the output first. Follow the account and Snowsight lesson when you are ready.
  2. For SQL practice, use a learning account in Snowsight and select an authorized role and warehouse. A role determines permissions; a warehouse supplies processing power. Follow the example’s database/schema setup when it refers to stored objects.
  3. Read the entire example, including comments beginning with --. Run the selected statement or labeled block in the stated order. Examples labeled Python, shell or HTTP belong in that client, not in a SQL editor.
  4. Compare values and row counts with the explained result. If an example deliberately causes an error, follow its rollback and cleanup steps before continuing.
SELECT / FROM
Choose the values to return / identify their input.
VALUES / COLUMN1
VALUES supplies tiny example rows. COLUMN1 means their first column, COLUMN2 their second.
AS / WITH
AS gives a result a readable name. WITH names a temporary query step within one statement.
NULL / ::
NULL means missing or unknown. The :: notation converts a value to a named data type.
Session
One connection and its settings. Keep related transaction steps in the same session.
Database.schema.table
A full address for stored data. It is separate from the warehouse that processes queries.

Need the L2_OBJECTS_LAB setup? Open the first database-object lesson →

Help with common practice errors
  • No active warehouse: select a warehouse your role can use. Do not assume you need to create a new one.
  • Object missing or not authorized: check the full name, required setup and active role. Ask the account owner for access if needed.
  • Object already exists: setup may already have run. Read the current state or choose a fresh lab name consistently; do not add OR REPLACE blindly.
  • Different result: check whether an earlier INSERT or UPDATE changed the data. VALUES examples provide their own fresh input for each statement.
Shared orders.csv and internal-stage setup
Our shared source file

Four orders, one CSV contract

Every CSV lesson uses this fictional orders.csv. One data record represents one order. The first line is a header; the four remaining lines are data. All amounts use the same fictional currency.

order_id,customer_name,amount,order_date
101,"Asha, Rao",120.50,2025-01-01
102,Ben,,2025-01-02
103,Cara,NULL,2025-01-03
104,Dev,0,2025-01-04

Notice the comma inside Asha’s quoted name, Ben’s empty amount, Cara’s literal NULL marker and Dev’s zero. We will follow these exact values from file bytes to parsed fields.

Setup order for optional manual practice
  1. Select an authorized sandbox database and schema. Keep this context consistent across your client sessions.
  2. Create orders_csv_v1 using lesson 3, then orders_stage using lesson 5. Use fresh sandbox names; do not replace existing shared objects.
  3. Save the text above as a UTF-8 file named orders.csv. Upload it with a supported local client or the named-stage upload interface.
  4. Keep only this sample file under the incoming/ prefix when following the four-row expected results.
  5. Select an authorized warehouse for the staged SELECT examples. File previews use compute; this website runs no SQL.

The examples assume the required role privileges described in the lessons. The external-stage and JSON examples have their own additional setup and are clearly marked.

Before running this lesson

Manual learning examples, not executed here. Use L2_OBJECTS_LAB.SALES from Module 03 and an authorized warehouse for previews. Run shared format/stage setup once. Cloud examples are templates: replace every <placeholder>, use approved cloud resources, and follow the provider setup before running SQL. No credentials belong in this website.

Create and inspect the GCS integration

SQL · example
CREATE STORAGE INTEGRATION m5_gcs_read
 TYPE=EXTERNAL_STAGE STORAGE_PROVIDER=GCS ENABLED=TRUE
 STORAGE_ALLOWED_LOCATIONS=('gcs://<lab-bucket>/incoming/')
 STORAGE_BLOCKED_LOCATIONS=('gcs://<lab-bucket>/incoming/private/');
DESC INTEGRATION m5_gcs_read;

What to expect and why

Give the returned STORAGE_GCP_SERVICE_ACCOUNT to the cloud administrator for the bucket grant. Stage URLs use gcs:// even though some Google tools use gs://.

After cloud permissions are configured

SQL · example
CREATE STAGE m5_gcs_stage
 URL='gcs://<lab-bucket>/incoming/'
 STORAGE_INTEGRATION=m5_gcs_read
 FILE_FORMAT=(FORMAT_NAME='orders_csv_v1');
LIST @m5_gcs_stage;

What to expect and why

Requires the shared CSV format and schema privileges. Expect orders.csv only after it is uploaded into the approved bucket prefix.

Check your understanding

Choose an answer, then check your reasoning. This is practice, not a scored test.

Which identity should receive the bucket grant?

Try it yourself

Why can creating the integration succeed while LIST fails?

Compare your reasoning

Snowflake object creation and cloud file access are separate. The bucket grant, encryption access or organization policy may still be missing.

Official sources and curriculum

Module 05 · See module scope