Error when assigning the Storage Admin IAM role to my service account

8/4/2020

I have the following script ( I've change the AZURE_PIPELINES_PUBLISHER ):

AZURE_PIPELINES_PUBLISHER=azure-pipelines-publisher@$GOOGLE_CLOUD_PROJECT.iam.gserviceaccount.com

gcloud projects add-iam-policy-binding $GOOGLE_CLOUD_PROJECT \
    --member serviceAccount:$AZURE_PIPELINES_PUBLISHER \
    --role roles/storage.admin

I write this script on 'Arguments' field of the Docker push task, in Azure DevOps, when i run the build, this task shows the following error:

unknown flag: --member

I get the script from the Google Cloud documentation.

What's wrong in the script?

-- Marcos Paulo Silva
azure-devops
devops
docker
google-cloud-platform
kubernetes

1 Answer

8/5/2020

From the tutorial, gcloud command should run in the Cloud Shell. It's not 'Arguments' of the Docker push task. It's supposed creating a Google Cloud service account in your production project and assign the role before you configure Azure Pipelines to build and publish a container image.

-- Cece Dong - MSFT
Source: StackOverflow