I try to use custome service account for Cloud Build to deploy Google Run Function.
I followed these instructions https://cloud.google.com/functions/docs/securing/build-custom-sa
and
https://cloud.google.com/build/docs/cloud-build-service-account-updates
In my local Cloud Tools for Power Shell I run the command:
gcloud functions deploy function-inventory-post --gen2 --region=us-central1 --runtime=python312 --source=. --entry-point=post_inventory --build-service-account=projects/daritap-development/serviceAccounts/custom-for-cloud-build@daritap-development.iam.gserviceaccount.com --trigger-http
It ends up with the error:
ERROR: (gcloud.functions.deploy) unrecognized arguments: --build-service-account=projects/daritap-development/serviceAccounts/custom-for-cloud-build@daritap-development.iam.gserviceaccount.com (did you mean '--run-service-account'?)
Hello @Raibek ,Welcome on Google Cloud Community.
I have question. Is this Cloud Function already deployed an you are trying to update it with new SA, or you are creating Function from scratch ?
--
cheers,
DamianS
LinkedIn medium.com Cloudskillsboost Sessionize Youtube
Hello, @DamianS ! Thanks!
I tried the both options many times tweaking the command but mostly I created Function from scratch.
I mean first I deleted the Function if it existed and tried again.
I'm facing the same issue when creating new cloud function using gcloud functions deploy
Eventually, I just
So, I use the legacy Cloud Build service account for deployment instead of the recommended way of creating your own service account for this activity.