Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud Build ERROR: (gcloud.scheduler.jobs.create.pubsub) PERMISSION_DENIED

Hi,

In my cloudbuild.yaml I'm creating a scheduler job:

  - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
    id: scheduler-daily
    waitFor: ['pubsub-topic-daily']
    entrypoint: bash
    args:
      - '-c'
      - | 
        gcloud scheduler jobs create pubsub schedulerName \
        --schedule="0 6 * * *" \
        --location=europe-west1 \
        --topic=projects/projectID/topics/topicName \
        --time-zone "Europe/Amsterdam" \
        --message-body '{"period": "yesterday"}' || echo "Scheduler already created"

When I try to run it in cloud build I get: 

ERROR: (gcloud.scheduler.jobs.create.pubsub) PERMISSION_DENIED: The principal (user or service account) lacks IAM permission "cloudscheduler.jobs.create" for the resource

How can I solve this?
0 2 945
2 REPLIES 2

Hi @Raynmakers,

Welcome to Google Cloud Community!

You can view this documentation for checking the role the by permission name in this link: IAM permissions reference

Look for "cloudscheduler.jobs.create" and it will provide a granted by roles which suitable for "Cloud Scheduler Admin (roles/cloudscheduler.admin)"

Then added it to your service account roles.

Hope this helps!

Hi @christianpaula 

I'm sorry, I'm still lost. Where should I go in the IAM & Admin to update the roles for the cloudscheduler?

Maarten