GCP Cloud Storage
This guide explains how to configure Google Cloud Platform (GCP) service account credentials for use with the Data Factory HTTP task.
Overview
GCP Service Account authentication allows the Data Factory HTTP task to access Google Cloud services such as:
- Cloud Storage - Object storage (GCS)
- BigQuery - Data warehouse
- Cloud Functions - Serverless functions
- Pub/Sub - Messaging service
- Any Google API - Using OAuth2 tokens
Prerequisites
- A Google Cloud Platform account
- A GCP project created
- Access to the GCP Console (IAM & Admin)
- Product-Live account with access to the Data Factory platform
Step 1: Create a Service Account
- Sign in to the Google Cloud Console
- Select your project from the dropdown at the top
- Navigate to IAM & Admin → Service Accounts
- Click Create Service Account
- Fill in the details:
- Service account name:
product-live-data-factory - Service account ID: (auto-generated)
- Description:
Service account for Product-Live Data Factory integration
- Service account name:
- Click Create and Continue
Step 2: Grant Permissions
Assign roles based on your use case:
For Cloud Storage Access
| Role | Description |
|---|---|
Storage Object Viewer | Read-only access to objects |
Storage Object Creator | Create objects only |
Storage Object Admin | Full access to objects |
Storage Admin | Full access to buckets and objects |
For BigQuery Access
| Role | Description |
|---|---|
BigQuery Data Viewer | Read access to datasets |
BigQuery Data Editor | Read and write access to datasets |
BigQuery Job User | Run queries |
For Custom/Restricted Access
Create a custom role with specific permissions:
- Go to IAM & Admin → Roles
- Click Create Role
- Add only the required permissions
Example permissions for Cloud Storage:
storage.objects.createstorage.objects.getstorage.objects.liststorage.objects.delete
After selecting roles, click Continue and then Done.
Step 3: Create a JSON Key
- Click on the newly created service account
- Go to the Keys tab
- Click Add Key → Create new key
- Select JSON format
- Click Create
Important
The JSON key file will be downloaded automatically. Store it securely! This file contains sensitive credentials and should never be committed to version control.
The downloaded JSON file will look like this:
json
{
"type": "service_account",
"project_id": "your-project-id",
"private_key_id": "abc123def456...",
"private_key": "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
"client_email": "product-live-data-factory@your-project.iam.gserviceaccount.com",
"client_id": "123456789012345678901",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/..."
}1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
Step 4: Extract Credentials
From the JSON key file, extract the following values:
| Field | JSON Key | Description |
|---|---|---|
| Project ID | project_id | Your GCP project identifier |
| Private Key ID | private_key_id | Unique identifier for the key |
| Private Key | private_key | RSA private key (PEM format) |
| Client Email | client_email | Service account email address |
| Client ID | client_id | Numeric client identifier |
Step 5: Configure Data Factory Variables
Create the following variables in your Data Factory project:
| Variable Name | Description | Mark as Secret |
|---|---|---|
gcp_project_id | Project ID | No |
gcp_private_key_id | Private Key ID | No |
gcp_private_key | Private Key (full PEM string) | Yes |
gcp_client_email | Service Account Email | No |
gcp_client_id | Client ID | No |
gcp_bucket_name | GCS Bucket Name (for storage operations) | No |
Private Key Format
The private key must include the full PEM format with headers:
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASC...
-----END PRIVATE KEY-----1
2
3
2
3
Make sure to preserve the \n characters when copying.
Step 6: Use in HTTP Task
Example configuration for uploading a file to Cloud Storage:
json
{
"name": "protocol-http-perform",
"taskReferenceName": "upload-to-gcs",
"type": "SUB_WORKFLOW",
"inputParameters": {
"scheme": "HTTPS",
"method": "POST",
"domain": "storage.googleapis.com",
"path": "/upload/storage/v1/b/${workflow.variables.gcp_bucket_name}/o?uploadType=media&name=my-folder/my-file.txt",
"headers": {
"Content-Type": "text/plain"
},
"body": {
"type": "PLAIN",
"contentType": "text/plain",
"text": "Hello from Product-Live Data Factory!"
},
"authentication": {
"useAuthentication": true,
"type": "GCP_SERVICE_ACCOUNT_KEY",
"gcpServiceAccountKeyProjectId": "${workflow.variables.gcp_project_id}",
"gcpServiceAccountKeyPrivateKeyId": "${workflow.variables.gcp_private_key_id}",
"gcpServiceAccountKeyPrivateKey": "${workflow.variables.gcp_private_key}",
"gcpServiceAccountKeyClientEmail": "${workflow.variables.gcp_client_email}",
"gcpServiceAccountKeyClientId": "${workflow.variables.gcp_client_id}",
"gcpServiceAccountKeyScope": ["https://www.googleapis.com/auth/cloud-platform"]
},
"responses": ["JSON"],
"connectionTimeOutMilliseconds": 30000
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Common Cloud Storage Operations
List Objects in a Bucket
json
{
"scheme": "HTTPS",
"method": "GET",
"domain": "storage.googleapis.com",
"path": "/storage/v1/b/${workflow.variables.gcp_bucket_name}/o",
"queryParameters": {
"maxResults": "100"
},
"authentication": {
"useAuthentication": true,
"type": "GCP_SERVICE_ACCOUNT_KEY",
"gcpServiceAccountKeyProjectId": "${workflow.variables.gcp_project_id}",
"gcpServiceAccountKeyPrivateKeyId": "${workflow.variables.gcp_private_key_id}",
"gcpServiceAccountKeyPrivateKey": "${workflow.variables.gcp_private_key}",
"gcpServiceAccountKeyClientEmail": "${workflow.variables.gcp_client_email}",
"gcpServiceAccountKeyClientId": "${workflow.variables.gcp_client_id}",
"gcpServiceAccountKeyScope": ["https://www.googleapis.com/auth/cloud-platform"]
},
"responses": ["JSON"]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Download an Object
json
{
"scheme": "HTTPS",
"method": "GET",
"domain": "storage.googleapis.com",
"path": "/storage/v1/b/${workflow.variables.gcp_bucket_name}/o/my-folder%2Fmy-file.txt",
"queryParameters": {
"alt": "media"
},
"authentication": {
"useAuthentication": true,
"type": "GCP_SERVICE_ACCOUNT_KEY",
"gcpServiceAccountKeyProjectId": "${workflow.variables.gcp_project_id}",
"gcpServiceAccountKeyPrivateKeyId": "${workflow.variables.gcp_private_key_id}",
"gcpServiceAccountKeyPrivateKey": "${workflow.variables.gcp_private_key}",
"gcpServiceAccountKeyClientEmail": "${workflow.variables.gcp_client_email}",
"gcpServiceAccountKeyClientId": "${workflow.variables.gcp_client_id}",
"gcpServiceAccountKeyScope": ["https://www.googleapis.com/auth/cloud-platform"]
},
"responses": ["FILE"]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
URL Encoding
Object names with / must be URL-encoded as %2F in the path.
Upload a Binary File
json
{
"scheme": "HTTPS",
"method": "POST",
"domain": "storage.googleapis.com",
"path": "/upload/storage/v1/b/${workflow.variables.gcp_bucket_name}/o?uploadType=media&name=my-folder/image.png",
"headers": {
"Content-Type": "image/png"
},
"body": {
"type": "BINARY_FILE",
"file": {
"url": "${previous_task.output.file.url}"
}
},
"authentication": {
"useAuthentication": true,
"type": "GCP_SERVICE_ACCOUNT_KEY",
"gcpServiceAccountKeyProjectId": "${workflow.variables.gcp_project_id}",
"gcpServiceAccountKeyPrivateKeyId": "${workflow.variables.gcp_private_key_id}",
"gcpServiceAccountKeyPrivateKey": "${workflow.variables.gcp_private_key}",
"gcpServiceAccountKeyClientEmail": "${workflow.variables.gcp_client_email}",
"gcpServiceAccountKeyClientId": "${workflow.variables.gcp_client_id}",
"gcpServiceAccountKeyScope": ["https://www.googleapis.com/auth/cloud-platform"]
},
"responses": ["JSON"]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Delete an Object
json
{
"scheme": "HTTPS",
"method": "DELETE",
"domain": "storage.googleapis.com",
"path": "/storage/v1/b/${workflow.variables.gcp_bucket_name}/o/my-folder%2Fmy-file.txt",
"authentication": {
"useAuthentication": true,
"type": "GCP_SERVICE_ACCOUNT_KEY",
"gcpServiceAccountKeyProjectId": "${workflow.variables.gcp_project_id}",
"gcpServiceAccountKeyPrivateKeyId": "${workflow.variables.gcp_private_key_id}",
"gcpServiceAccountKeyPrivateKey": "${workflow.variables.gcp_private_key}",
"gcpServiceAccountKeyClientEmail": "${workflow.variables.gcp_client_email}",
"gcpServiceAccountKeyClientId": "${workflow.variables.gcp_client_id}",
"gcpServiceAccountKeyScope": ["https://www.googleapis.com/auth/cloud-platform"]
}
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
OAuth2 Scopes Reference
| Scope | Description |
|---|---|
https://www.googleapis.com/auth/cloud-platform | Full access to all GCP services |
https://www.googleapis.com/auth/devstorage.read_only | Read-only access to Cloud Storage |
https://www.googleapis.com/auth/devstorage.read_write | Read/write access to Cloud Storage |
https://www.googleapis.com/auth/devstorage.full_control | Full control of Cloud Storage |
https://www.googleapis.com/auth/bigquery | Full access to BigQuery |
Best Practice
Use the most restrictive scope possible. For Cloud Storage operations, prefer devstorage.read_write over cloud-platform.
Troubleshooting
Error: "Invalid grant: Invalid JWT Signature"
- The private key is incorrect or corrupted
- Ensure the full PEM format is preserved (including
-----BEGIN PRIVATE KEY-----headers) - Check that
\ncharacters are properly interpreted
Error: "Permission denied"
- The service account doesn't have the required IAM roles
- Check bucket-level permissions (go to Cloud Storage → Bucket → Permissions)
- Verify the bucket name is correct
Error: "The caller does not have permission"
- The OAuth2 scope doesn't include the required permissions
- Add the appropriate scope to
gcpServiceAccountKeyScope
Error: "Not Found"
- The bucket or object doesn't exist
- Check the bucket name and object path
- Ensure the region is correct (some operations require region-specific endpoints)
Security Best Practices
- Use least privilege - Grant only the minimum required roles
- Rotate keys regularly - Create new keys and delete old ones periodically
- Use separate service accounts - One per application/environment
- Never commit keys - Use Data Factory secrets for the private key
- Enable audit logging - Monitor service account activity in Cloud Audit Logs
- Set key expiration - Configure automatic key rotation if possible
- Use VPC Service Controls - For sensitive data, restrict access to specific networks
GCP Regions Reference
| Region | Location |
|---|---|
us-central1 | Iowa, USA |
us-east1 | South Carolina, USA |
europe-west1 | Belgium |
europe-west3 | Frankfurt, Germany |
europe-west9 | Paris, France |
asia-east1 | Taiwan |
asia-northeast1 | Tokyo, Japan |
For a complete list, see GCP Regions and Zones.