This document describes how to remove an
[ACL entry](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/kafka-acls/create-kafka-acls.md.txt#acl-entries)
from a Managed Kafka ACL resource.

Removing an ACL entry is analogous to deleting a single Apache Kafka ACL
binding. Unlike the
[update operation](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/kafka-acls/update-kafka-acls.md.txt),
this operation doesn't require an ETag for concurrency control.

## Required roles and permissions


To get the permission that
you need to remove an ACL entry,

ask your administrator to grant you the
[Managed Kafka ACL Editor](https://docs.cloud.google.com/iam/docs/roles-permissions/managedkafka.md.txt#managedkafka.aclEditor) (`roles/managedkafka.aclEditor`) IAM role on your project.


For more information about granting roles, see [Manage access to projects, folders, and organizations](https://docs.cloud.google.com/iam/docs/granting-changing-revoking-access.md.txt).


This predefined role contains the
`managedkafka.acls.updateEntries`
permission,
which is required to
remove an ACL entry.


You might also be able to get
this permission
with [custom roles](https://docs.cloud.google.com/iam/docs/creating-custom-roles.md.txt) or
other [predefined roles](https://docs.cloud.google.com/iam/docs/roles-overview.md.txt#predefined).

## Remove an ACL entry

### Console

1. In the Google Cloud console, go to the **Clusters** page.


   [Go to Clusters](https://console.cloud.google.com/managedkafka/clusters)

   <br />

2. Click the name of the cluster that contains the ACL entry.

3. Click the **Access control** tab.

4. In the **ACL entries** list, select one or more ACL entries to delete.

5. Click **Delete**.

### gcloud

Run the
[`gcloud managed-kafka acls remove-acl-entry`](https://docs.cloud.google.com/sdk/gcloud/reference/managed-kafka/acls/remove-acl-entry)
command:

```bash
gcloud managed-kafka acls remove-acl-entry ACL_ID \
  --cluster=CLUSTER_ID \
  --location=LOCATION \
  --principal=PRINCIPAL \
  --operation=OPERATION \
  --permission-type=PERMISSION-TYPE \
  --host=*
```

Replace the following:

- `ACL_ID`. The ID of the Managed Kafka ACL resource
  to update. For more information, see
  [ACL ID](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/kafka-acls/create-kafka-acls.md.txt#acl-id).

- `CLUSTER_ID` The ID of your Kafka cluster.

- `LOCATION` The region of your Kafka cluster.

- `PRINCIPAL`: The
  [principal](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/kafka-acls/create-kafka-acls.md.txt#acl-principal)
  of the ACL entry to remove.

- `OPERATION`: The
  [operation type](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/kafka-acls/create-kafka-acls.md.txt#acl-operation),
  such as `READ` or `CREATE`, of the ACL entry to remove.

- `PERMISSION_TYPE`: The permission type (`ALLOW` or
  `DENY`) of the ACL entry to remove.

Together, the `--principal`, `--operation`, and `--permission-type` flags
specify which ACL entry to remove.

## Sample command

Run the following command to remove an ACL entry that allows a specific service
account to read from a topic named `test-topic` in the cluster `test-cluster` in
the `us-central1` region. If this ACL entry was the only one, the ACL is deleted
and the response contains `deleted: True`. Otherwise, the updated ACL entry is
returned.

```bash
gcloud managed-kafka acls remove-acl-entry topic/test-topic \
  --cluster=test-cluster \
  --location=us-central1 \
  --principal='User:service-account@test-project.iam.gserviceaccount.com' \
  --operation=READ \
  --permission-type=ALLOW \
  --host='*' \
```

## What's next

- [List ACLs](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/kafka-acls/list-kafka-acls.md.txt)

- [View an ACL](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/kafka-acls/view-kafka-acl.md.txt)

- [Create an ACL](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/kafka-acls/create-kafka-acls.md.txt)

- [Add an ACL entry](https://docs.cloud.google.com/managed-service-for-apache-kafka/docs/kafka-acls/add-acl-entry.md.txt)

*Apache Kafka® is a registered
trademark of The Apache Software Foundation or its affiliates in the United
States and/or other countries.*