Azure CLI 是 Azure 云服务的命令行工具,提供对存储容器的高效管理能力。以下为常用操作及示例:
1. 创建存储容器
使用 az storage container create
命令,可指定容器名称和访问权限:
az storage container create --name mycontainer --account-name mystorageaccount --public-access blob
2. 列出所有容器
az storage container list --account-name mystorageaccount
输出结果包含容器名称、状态及最后修改时间等信息。
3. 删除容器
az storage container delete --name mycontainer --account-name mystorageaccount
⚠️ 删除操作不可逆,请确保容器内无重要数据。
4. 设置容器权限
通过 --public-access
参数控制访问级别:
off
:私有容器(默认)blob
:允许匿名读取 Blobcontainer
:允许匿名列表容器
扩展阅读
如需深入了解存储容器生命周期管理,可访问 Azure 存储容器生命周期管理指南 获取更多高级功能说明。