A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/binary-authorization/docs/run/enabling-binauthz-cloud-run below:

Enable Binary Authorization for Cloud Run

Skip to main content Enable Binary Authorization for Cloud Run

Stay organized with collections Save and categorize content based on your preferences.

This guide shows you how to set up Binary Authorization to enforce policy-based deployment of Cloud Run services and jobs.

Note: After Binary Authorization is enabled, it enforces any update to the Cloud Run service. When you implement a change that affects traffic, Binary Authorization enforces deployment on any Cloud Run revision receiving traffic. Before you begin

Set up Cloud Run and enable APIs, by doing the following:

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Note: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.

    Go to project selector

  3. Verify that billing is enabled for your Google Cloud project.

  4. Enable the Cloud Run, Artifact Registry, Binary Authorization APIs.

    Enable the APIs

  5. Install the Google Cloud CLI.

  6. If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

  7. To initialize the gcloud CLI, run the following command:

    gcloud init
Enable Binary Authorization on an existing Cloud Run service

You can enable Binary Authorization enforcement on an existing service. To activate enforcement after enabling it, you might need to deploy a revision or update service traffic.

You can enable Binary Authorization enforcement on an existing service using the Google Cloud console or Google Cloud CLI:

Console
  1. Go to the Cloud Run page in the Google Cloud console.

    Go to Cloud Run

  2. Click the service.

  3. Click the Security tab.

  4. To enable Binary Authorization enforcement on the service, click Enable.

  5. Optional: To configure the Binary Authorization policy, click Configure Policy.

gcloud

Enable Binary Authorization on the service and deploy it:

gcloud run services update SERVICE_NAME --binary-authorization=default

Replace SERVICE_NAME with a name for your service.

YAML
  1. If you are creating a new service, skip this step. If you are updating an existing service, download its YAML configuration:

    gcloud run services describe SERVICE --format export > service.yaml
  2. Update the run.googleapis.com/binary-authorization: annotation as follows:

    apiVersion: serving.knative.dev/v1
    kind: Service
    metadata:
      annotations:
        run.googleapis.com/binary-authorization: POLICY
      name: SERVICE
    spec:
      template:

    Replace the following:

  3. Replace the service with its new configuration using the following command:

gcloud run services replace service.yaml
Note: We recommend that you require Binary Authorization for Cloud Run by configuring an organization policy to do so. Binary Authorization can be disabled by Cloud Run developers if the policy is not configured. Enable Binary Authorization on an existing Cloud Run job

You can enable Binary Authorization enforcement on an existing job using the Google Cloud console or Google Cloud CLI:

Console
  1. Go to the Cloud Run jobs page in the Google Cloud console.

    Go to Cloud Run

  2. Click the job to open the job details.

  3. Click the Configuration tab.

  4. Under Binary Authorization, select a policy from the policy list.

  5. Click Apply to enable Binary Authorization enforcement on the job.

  6. Optional: To configure the Binary Authorization policy, click Configure Policy.

gcloud

Enable Binary Authorization on the job:

gcloud run jobs update JOB_NAME --binary-authorization=POLICY

Replace the following:

We recommend that you require Binary Authorization for Cloud Run by configuring an organization policy to do so. Binary Authorization can be disabled by Cloud Run developers if the policy is not configured.

View the policy

To view the policy, click View policy.

For more information, see configuring a Binary Authorization policy.

Service or job deploy failure

If your service or job fails to deploy because it violates the Binary Authorization policy, you might see an error like the following:

Revision REVISION_NAME uses an unauthorized container image.
Container image IMAGE_NAME is not authorized by policy.
Note: The service or job displays a red exclamation point, but the service continues to serve the previously serving healthy revision.

The error also contains information about why the image violated the policy. In this case, you can use breakglass to bypass policy enforcement and deploy the image.

Note: Using breakglass creates a log entry. View breakglass events in Cloud Audit Logs. Enable Binary Authorization on a new service

You can enable Binary Authorization on a new service using the Google Cloud console or Google Cloud CLI:

Console
  1. Go to the Cloud Run page:

    Go to Cloud Run

  2. Click Create service.

  3. In the Create service form :

    1. Select Cloud Run as your development platform.
    2. Select the region where you want your service located.
    3. Enter the service name.
    4. Click Next to continue to the Configure the service's first revision page.
    5. Select Deploy one revision from an existing container image.
    6. Enter or select the image to deploy.
    7. Expand the Advanced settings section.
    8. Click the Security tab.
    9. Select the Verify container deployment with Binary Authorization checkbox.

      Note: This checkbox might be disabled if your organization policy is set to require Binary Authorization for Cloud Run.
    10. Optional: Click Configure policy to configure the Binary Authorization policy. To learn more about configuring a policy, see Configuring a policy

    11. Deploy the service.

gcloud

Enable Binary Authorization on the service and deploy it:

  gcloud run deploy SERVICE_NAME --image=IMAGE_URL --binary-authorization=default --region=REGION

Replace the following:

Enable Binary Authorization on a new job

You can enable Binary Authorization on a new job using the Google Cloud CLI:

gcloud
  1. Create a new job with Binary Authorization enabled:

    gcloud run jobs create JOB_NAME \
      --image IMAGE_URL OPTIONS \
      --binary-authorization=POLICY \
      --region=REGION

    Replace the following:

  2. Wait for the job creation to finish. Upon successful completion, the console displays a success message.

  3. To execute the job, see Execute jobs or execute jobs on a schedule.

When you create a new job, the Cloud Run service agent needs to be able to access the container, which is the case by default.

YAML
  1. Create a new job.yaml file with this content:

    apiVersion: run.googleapis.com/v1
    kind: Job
    metadata:
      name: JOB
      annotations:
        run.googleapis.com/binary-authorization: POLICY
    spec:
      template:
        spec:
          containers:
          - image: IMAGE

    Replace the following:

  2. Deploy the new job using the following command:

    gcloud run jobs replace job.yaml
What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["This guide demonstrates how to enable Binary Authorization for both Cloud Run services and jobs, ensuring only policy-compliant deployments."],["Binary Authorization can be enabled on existing or new Cloud Run services and jobs through the Google Cloud console, gcloud CLI, or YAML configuration."],["When enabled, Binary Authorization enforces deployment policies on any updates or revisions to Cloud Run services and jobs receiving traffic, potentially resulting in deployment failures if policies are violated."],["Users can customize the Binary Authorization policy and apply it, with the option to use a `default` policy, to dictate which container images are authorized for deployment."],["If a deployment violates the Binary Authorization policy, the service or job will display an error, but it continues to serve the previously healthy revision, however, users can bypass policy with breakglass."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4