Share via


Quickstart: Delete an Azure Red Hat OpenShift 4 cluster

In this Quickstart, you learn how to delete an Azure Red Hat OpenShift cluster. When you delete a cluster, all the managed objects are deleted, but resources like the resource group, virtual network, and subnets must be manually deleted.

Prerequisites

This article requires Azure CLI version 2.6.0 or later. To find the version, run the az --version command. If you need to install or upgrade, see Install Azure CLI.

Sign in to Azure

If you're running the Azure CLI locally, run az login to sign in to Azure.

az login

If you have access to multiple Azure subscriptions, run the following command and replace {subscription ID} with the subscription you want to use.

az account set --subscription {subscription ID}

Delete the cluster

In previous articles to create and connect to a cluster, you created a resource group and cluster name. For the following variables, replace resourceGroupName and clusterName with the values you used to create your cluster:

RESOURCEGROUP=resourceGroupName
CLUSTER=clusterName

Use these values in the following command to delete your cluster:

az aro delete --resource-group $RESOURCEGROUP --name $CLUSTER

You're prompted to confirm if you're sure you want to perform this operation. After you confirm with y, it will take several minutes to delete the cluster. When the command finishes, the cluster is deleted and all the managed objects.

Delete the resource group

Resources like the resource group, virtual network, and subnets must be manually deleted.

Run the following command to delete the resource group and all the resources it contains. Respond with y to confirm you want to delete the resources.

az group delete --name $RESOURCEGROUP

Next steps

Learn more about using OpenShift with the official Red Hat OpenShift documentation.