As seen below I am editing the permissions for access to my Cloud Function called task
. I am following the advice from GCP that says the following:
This resource is public and can be accessed by anyone on the internet. To remove public access, remove "allUsers" and "allAuthenticatedUsers" from the resource's members.
so that my function can only be called from my GCP. So I removed the allUsers
access for the Cloud Functions Invoker
role. But now I am trying to add a new member (service account) with the Cloud Functions Invoker
role:
However I don't know what service account my Cloud Tasks are fired from. I've created a new service account with only Cloud Tasks permissions but I don't know how to actually make my Cloud Tasks use this service account when executing. There doens't seem to be an option for that:
Any idea?
According to the Google docs, "Cloud Tasks can call HTTP Target handlers that require authentication if you have a service account with the appropriate credentials to access the handler."
You may need to create a service account and give the appropriate roles to it.
Please follow the official Google documentation [1] where the steps to follow are detailed.
[1] - https://cloud.google.com/tasks/docs/creating-http-target-tasks#sa