Documentation

Package

On this page

acl add

kafka acl add <principals...>

Create one or more ACLs, granting or denying an operation

Arguments

Argument Description
principals... principals to grant, e.g. User:alice

Shared options and defaults: connection profiles, JSON output, logging and help.

Defaults

Pattern type defaults to literal, permission to allow, and host to *. Use –dry-run to inspect entries before applying.

Before you run

Changes authorization. A permissive principal/host/pattern can grant broader access than intended. Inspect a dry run; remove the exact added bindings to undo it.

Flags

Flag Description
--brokers <string> comma-separated broker list, e.g. localhost:9092
--resource-type <string> resource type: topic, group, cluster, transactional-id, delegation-token
--resource-name <string> exact name of the resource
--pattern-type <string> resource pattern type: literal or prefixed (default: literal)
--operation <string> (repeatable) operation to grant (repeatable), e.g. read, write
--host <string> host the principal connects from (default: *)
--permission-type <string> allow or deny (default: allow)
--dry-run print what would be created without creating anything

Examples

kafka acl add User:alice --resource-type topic --resource-name orders --operation read --operation write
kafka acl add User:alice User:bob --resource-type group --resource-name my-group --operation read --dry-run

Output

Illustrative, abbreviated output. Empty arrays show the result envelope; actual entries, identifiers, optional fields and broker errors depend on the request and cluster.

With --json:

{
  "results": []
}

Declared exit codes: 0, 1, 2, 4. See the exit-code reference for meanings.

Browse the command group · Exit codes