'Authenticate GCP Service Account via environment /variable

Authentication for a GCP Service Account usually requires a .json file containing the credentials.

The command is: gcloud auth activate-service-account --key-file "path to .json file"

If the above command is run as a subprocess in Python3 how could one pass the --key-file by storing the contents of the .json in memory. The requirement is to not have/create the file on local storage.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source