Module 3: Service Identity and Authentication

Looking for โ€˜Developing Applications with Cloud Run on Google Cloud: Fundamentals Module 3 Answersโ€™?

In this post, I provide complete, accurate, and detailed explanations for the answers to Module 3: Service Identity and Authentication of Developing Applications with Cloud Run on Google Cloud: Fundamentals โ€“ Preparing for Google Cloud Certification: Cloud Developer Professional Certificate

Whether youโ€™re preparing for quizzes or brushing up on your knowledge, these insights will help you master the concepts effectively. Letโ€™s dive into the correct answers and detailed explanations for each question!

Quiz

Graded Assignment

1. Every Cloud Run service is linked to a service account by default. What role is given to this service account?

  • Owner
  • Billing Admin
  • Editor โœ…
  • Viewer

Explanation:

  • Every Cloud Run service is linked to a default service account.
  • By default, this service account is given the Editor role, which provides read and write access to most Google Cloud resources.

2. What are some characteristics of an IAM policy? Select three.

  • An IAM policy consists of a list of policy bindings that binds members to roles. โœ…
  • A member can only have a single role in an IAM policy.
  • An IAM policy is attached to a Google Cloud resource. โœ…
  • An IAM policy consists of at most one policy binding that binds a member to one or more roles.
  • You can attach only one IAM policy to a resource. โœ…

Explanation:

  • IAM policies bind members (users, groups, service accounts) to roles.
  • IAM policies are attached to Google Cloud resources like projects, Cloud Run services, or storage buckets.
  • Only one IAM policy is attached per resource, but a policy can contain multiple bindings.

3. How can you implement the principle of least privilege for a Cloud Run service?

  • Use secrets to store data that is needed by the Cloud Run service.
  • Remove the Editor role on the default service account that is used by Cloud Run.
  • Use only Google client libraries to access Google Cloud APIs and services.
  • Create a new service account and configure it as the Cloud Run serviceโ€™s identity. Grant minimal permissions to the account on the resources that the service needs to access. โœ…

Explanation:

  • The principle of least privilege means only granting necessary permissions.
  • The best practice is to create a new service account with minimal required permissions.

4. Which statements about using environment variables with Cloud Run are correct? Select two.

  • Once set, the value of an environment variable cannot be updated.
  • Environment variables set in the container with the ENV statement in a Dockerfile take precedence over variables with the same name set on a Cloud Run service or job.
  • Environment variables are injected into your application container and accessed by your code at runtime. โœ…
  • Environment variables are key-value pairs that can be set when deploying a Cloud Run service or job. โœ…

Explanation:

  • Environment variables store configuration settings and are injected into the container when running.
  • They are defined as key-value pairs during deployment.

5. What are two methods of making a secret available to a Cloud Run service?

  • Secrets cannot be accessed from a Cloud Run service.
  • Mount the secret as a volume so that the service can access the secret from a file. โœ…
  • Provide the secret name and value as query parameters in the request to the service.
  • Provide the secret as an environment variable when deploying the service. โœ…

Explanation:

  • Cloud Run can access secrets stored in Google Secret Manager in two ways:

    1. Mounting as a volume โ†’ The secret is accessible as a file.
    2. Using environment variables โ†’ The secret value is stored in an env variable.

Leave a Reply