Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gar_service_provision

Provision a service account


Description

This uses all the gar_service_create functions to enable creating service account roles more easily

Usage

gar_service_provision(
  accountId,
  roles,
  json = Sys.getenv("GAR_CLIENT_JSON"),
  file = paste0(accountId, "-auth-key.json"),
  email = Sys.getenv("GARGLE_EMAIL")
)

Arguments

accountId

The service accountId

roles

A character vector of roles to give the accountIds e.g. roles/editor - see list of roles here https://cloud.google.com/iam/docs/understanding-roles#predefined_roles or in your GCP console https://console.cloud.google.com/iam-admin/roles/details/roles

json

The file location of an OAuth 2.0 client ID json file

file

The file to download the private JSON key to

email

An existing gargle cached email to authenticate with or TRUE to authenticate with the only email available.

Details

You will need the OAuth2.0 Client ID JSON from your GCP project via menu icon > APIs & Services > Credentials > Create Credentials > OAuth client ID

You need to authenticate with a user with permission iam.serviceAccounts.create for the project. Most often the user is an Owner/Editor

See Also

Other IAM functions: gar_service_create()

Examples

## Not run: 

gar_service_provision("my-service-account", 
                      c("roles/viewer", "roles/bigquery.jobUser"))

## End(Not run)

googleAuthR

Authenticate and Create Google APIs

v1.4.0
MIT + file LICENSE
Authors
Mark Edmondson [aut, cre] (<https://orcid.org/0000-0002-8434-3881>), Jennifer Bryan [ctb], Johann deBoer [ctb], Neal Richardson [ctb], David Kulp [ctb], Joe Cheng [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.