Deleting a schema registry is an irreversible action. All subjects, schemas, and versions contained within the registry are permanently deleted. Ensure that no active Kafka clients rely on this registry before proceeding.
Required roles and permissions
To get the permissions that
you need to delete a schema registry,
ask your administrator to grant you the
Managed Kafka Schema Registry Editor (roles/managedkafka.schemaRegistryEditor
)
IAM role on the schema registry instance.
For more information about granting roles, see Manage access to projects, folders, and organizations.
This predefined role contains the permissions required to delete a schema registry. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to delete a schema registry:
-
Grant the following permission on the schema registry:
managedkafka.schemaRegistries.delete
-
Grant the following permission for console users to list schema registries:
managedkafka.schemaRegistries.list
-
Grant the following permission for console users to get schema registry details:
managedkafka.schemaRegistries.get
You might also be able to get these permissions with custom roles or other predefined roles.
The higher-level Managed Kafka Schema Registry Admin
(roles/managedkafka.schemaRegistryAdmin
) role also includes
these permissions.
For more information about the predefined roles available for Managed Service for Apache Kafka, see the Access control documentation.
Delete a schema registry
To permanently delete a schema registry and all its contents, follow these steps:
Console
- In the Google Cloud console, go to the Schema registries page.
A list of schema registries in your project is displayed.
- Click the name of the schema registry that you want to delete.
- On the Schema registry details page, click the Delete button.
- Confirm the deletion when prompted.
gcloud
-
After installing the Google Cloud CLI, initialize it by running the following command:
gcloud init
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Use the
gcloud beta managed-kafka schema-registries delete
command:gcloud beta managed-kafka schema-registries delete SCHEMA_REGISTRY_ID \ --location=LOCATION \
Replace the following:
SCHEMA_REGISTRY_ID
(required): the ID of the schema registry you want to delete.LOCATION
(required): the Google Cloud region where the schema registry is located.
For example—to delete a schema registry named testRegistry
in the us-central1
region, run the following command:
gcloud beta managed-kafka schema-registries delete testRegistry \ --location=us-central1
API
Make a DELETE
request to the specific resource URI of the
schema registry you want to delete.
DELETE https://managedkafka.googleapis.com/v1main/projects/PROJECT_ID/locations/LOCATION/schemaRegistries/SCHEMA_REGISTRY_ID
Replace the following:
PROJECT_ID
(required): your Google Cloud project ID.SCHEMA_REGISTRY_ID
(required): the ID of the schema registry you want to delete.LOCATION
(required): the Google Cloud region where the schema registry is located.
If the request is successful and the schema registry is deleted, the API
typically returns a 200 OK
status code with an empty JSON body
indicating the completion of a long-running operation or the operation
resource itself.
If the specified schema registry does not exist, you receive a
404 Not Found
error.
If you lack permissions, you receive
a 403 Forbidden
error.