Skip to content

Commit c334abd

Browse files
authored
dataflow: simplify authentication instructions (#7198)
* dataflow: simplify authentication instructions * Made HTML span less lines * add note on permissions
1 parent a327988 commit c334abd

File tree

1 file changed

+19
-46
lines changed

1 file changed

+19
-46
lines changed

Diff for: dataflow/README.md

+19-46
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,20 @@ This guides you through all the steps needed to run an Apache Beam pipeline in t
1212
The following instructions help you prepare your Google Cloud project.
1313

1414
1. Install the [Cloud SDK](https://cloud.google.com/sdk/docs/).
15-
> *Note:* This is not required in
15+
16+
> ℹ️ This is not required in
1617
> [Cloud Shell](https://console.cloud.google.com/cloudshell/editor)
1718
> since it already has the Cloud SDK pre-installed.
1819
19-
1. Create a new Google Cloud project via the
20-
[*New Project* page](https://console.cloud.google.com/projectcreate),
21-
or via the `gcloud` command line tool.
20+
1. Create a new Google Cloud project and save the project ID in an environment variable.
21+
22+
<button><a href="https://console.cloud.google.com/projectcreate">
23+
Click here to create a new project
24+
</a></button>
2225

2326
```sh
27+
# Save your project ID in an environment variable for ease of use later on.
2428
export PROJECT=your-google-cloud-project-id
25-
gcloud projects create $PROJECT
2629
```
2730

2831
1. Setup the Cloud SDK to your GCP project.
@@ -33,53 +36,23 @@ The following instructions help you prepare your Google Cloud project.
3336

3437
1. [Enable billing](https://cloud.google.com/billing/docs/how-to/modify-project).
3538

36-
1. [Enable the Dataflow API](https://console.cloud.google.com/flows/enableapi?apiid=dataflow).
37-
38-
1. Create a service account JSON key via the
39-
[*Create service account key* page](https://console.cloud.google.com/apis/credentials/serviceaccountkey),
40-
or via the `gcloud` command line tool.
41-
Here is how to do it through the *Create service account key* page.
39+
1. Enable the Dataflow API.
4240

43-
* From the **Service account** list, select **New service account**.
44-
* In the **Service account name** field, enter a name.
45-
* From the **Role** list, select **Project > Owner** **(*)**.
46-
* Click **Create**. A JSON file that contains your key downloads to your computer.
41+
<button><a href="https://console.cloud.google.com/flows/enableapi?apiid=dataflow">
42+
Click here to enable the API
43+
</a></button>
4744

48-
Alternatively, you can use `gcloud` through the command line.
45+
1. Authenticate to your Google Cloud project.
4946

5047
```sh
51-
export PROJECT=$(gcloud config get-value project)
52-
export SA_NAME=samples
53-
export IAM_ACCOUNT=$SA_NAME@$PROJECT.iam.gserviceaccount.com
54-
55-
# Create the service account.
56-
gcloud iam service-accounts create $SA_NAME --display-name $SA_NAME
57-
58-
# Set the role to Project Owner (*).
59-
gcloud projects add-iam-policy-binding $PROJECT \
60-
--member serviceAccount:$IAM_ACCOUNT \
61-
--role roles/owner
62-
63-
# Create a JSON file with the service account credentials.
64-
gcloud iam service-accounts keys create path/to/your/credentials.json \
65-
--iam-account=$IAM_ACCOUNT
48+
gcloud auth application-default login
6649
```
6750

68-
> **(*)** *Note:* The **Role** field authorizes your service account to access resources.
69-
> You can view and change this field later by using the
70-
> [GCP Console IAM page](https://console.cloud.google.com/iam-admin/iam).
71-
> If you are developing a production app, specify more granular permissions than **Project > Owner**.
72-
> For more information, see
73-
> [Granting roles to service accounts](https://cloud.google.com/iam/docs/granting-roles-to-service-accounts).
74-
75-
For more information, see
76-
[Creating and managing service accounts](https://cloud.google.com/iam/docs/creating-managing-service-accounts)
77-
78-
1. Set your `GOOGLE_APPLICATION_CREDENTIALS` environment variable to point to your service account key file.
79-
80-
```sh
81-
export GOOGLE_APPLICATION_CREDENTIALS=path/to/your/credentials.json
82-
```
51+
> ℹ️ For more information on authentication, see the
52+
> [Authentication overview](https://googleapis.dev/python/google-api-core/latest/auth.html) page.
53+
>
54+
> To learn more about the permissions needed for Dataflow, see the
55+
> [Dataflow security and permissions](https://cloud.google.com/dataflow/docs/concepts/security-and-permissions) page.
8356
8457
## Setting up a Python development environment
8558

0 commit comments

Comments
 (0)