删除 Azure Redis 缓存Delete an Azure Cache for Redis

在本方案中,了解如何删除 Azure Redis 缓存。In this scenario, you learn how to delete an Azure Cache for Redis.

若要运行此示例,请确保已安装最新版本的 Azure CLITo run this sample, make sure you have installed the latest version of the Azure CLI. 若要开始,请运行 az login 以创建与 Azure 的连接。To start, run az login to create a connection with Azure.

此示例在 Bash shell 中正常工作。This sample works in a Bash shell. 有关在 Windows 客户端上运行 Azure CLI 脚本的选项,请参阅在 Windows 上安装 Azure CLIFor options on running Azure CLI scripts on Windows client, see Install the Azure CLI on Windows.

示例脚本Sample script

#/bin/bash

# Delete a Redis Cache named contosoCache from the Resource Group contosoGroup
az redis delete --name contosoCache --resource-group contosoGroup

清理部署Clean up deployment

运行脚本示例后,可以使用以下命令删除资源组、Azure Redis 缓存实例以及资源组中的任何相关资源。After the script sample has been run, the follow command can be used to remove the resource group, Azure Cache for Redis instance, and any related resources in the resource group.

az group delete --name contosoGroup

脚本说明Script explanation

此脚本使用以下命令删除 Azure Redis 缓存实例。This script uses the following commands to delete an Azure Cache for Redis instance. 表中的每条命令均链接到特定于命令的文档。Each command in the table links to command specific documentation.

命令Command 注释Notes
az redis deleteaz redis delete 删除 Azure Redis 缓存实例。Delete Azure Cache for Redis instance.

后续步骤Next steps

有关 Azure CLI 的详细信息,请参阅 Azure CLI 文档For more information on the Azure CLI, see Azure CLI documentation.

可以在 Azure Redis 缓存文档中找到其他 Azure Redis 缓存 CLI 脚本示例。Additional Azure Cache for Redis CLI script samples can be found in the Azure Cache for Redis documentation.