// Module included in the following assemblies:
//
// assembly-using-the-user-operator.adoc

[id='proc-creating-kafka-user-scram-{context}']
= Creating a Kafka user with SCRAM SHA authentication

.Prerequisites

* A running Kafka cluster configured with a listener using SCRAM SHA authentication.
* A running User Operator.

.Procedure

. Prepare a YAML file containing the `KafkaUser` to be created.
+
.An example `KafkaUser`
[source,yaml,subs="attributes+"]
----
apiVersion: {KafkaUserApiVersion}
kind: KafkaUser
metadata:
  name: my-user
  labels:
    strimzi.io/cluster: my-cluster
spec:
  authentication:
    type: scram-sha-512
  authorization:
    type: simple
    acls:
      - resource:
          type: topic
          name: my-topic
          patternType: literal
        operation: Read
      - resource:
          type: topic
          name: my-topic
          patternType: literal
        operation: Describe
      - resource:
          type: group
          name: my-group
          patternType: literal
        operation: Read
----

. Create the `KafkaUser` resource in {ProductPlatformName}.
+
ifdef::Kubernetes[]
On {KubernetesName} this can be done using `kubectl apply`:
+
[source,shell,subs=+quotes]
kubectl apply -f _your-file_
+
endif::Kubernetes[]
On {OpenShiftName} this can be done using `oc apply`:
+
[source,shell,subs=+quotes]
oc apply -f _your-file_

. Use the credentials from the secret `my-user` in your application

.Additional resources

* For more information about deploying the Cluster Operator, see xref:cluster-operator-str[].
* For more information about configuring a listener that authenticates using SCRAM SHA see xref:assembly-configuring-kafka-broker-listeners-deployment-configuration-kafka[].
* For more information about deploying the Entity Operator, see xref:assembly-kafka-entity-operator-deployment-configuration-kafka[].
* For more information about the `KafkaUser` object, see xref:type-KafkaUser-reference[`KafkaUser` schema reference].
