gpt4 book ai didi

azure - 我是否可以对 Azure 存储进行 API 调用来判断我的容器是否已被删除?

转载 作者:行者123 更新时间:2023-12-03 00:27:07 25 4
gpt4 key购买 nike

我想清除存储帐户,然后使用 AzCopy“恢复”它。

我使用清除昨晚的存储


$ctx = New-AzureStorageContext -StorageAccountName $storage -StorageAccountKey $key
获取-AzureStorageContainer a* -Context $ctx |删除-AzureStorageContainer-Force

然后使用AzCopy却得到;


远程服务器返回错误:(409) 冲突。
正在删除指定的容器。稍后尝试操作。

我不想循环,尝试再次创建存储。如何等待删除操作完成?

是否有 Get-AzureStorageContainer 状态? “删除?”

最佳答案

Is there a Get-AzureStorageContainer status? "Deleting?"

不幸的是没有。你只需要继续努力。

基于此处的文档:https://msdn.microsoft.com/en-us/library/azure/dd179408.aspx

When a container is deleted, a container with the same name cannot be created for at least 30 seconds; the container may not be available for more than 30 seconds if the service is still processing the request. While the container is being deleted, attempts to create a container of the same name will fail with status code 409 (Conflict), with the service returning additional error information indicating that the container is being deleted. All other operations, including operations on any blobs under the container, will fail with status code 404 (Not Found) while the container is being deleted.

虽然他们说的是 30 秒,但根据容器中 blob 的数量,可能需要更长的时间。

另一种选择是单独删除所有 blob,而不是删除容器。但是,由于每个删除都是单独的网络调用,因此该过程可能会运行较长的持续时间(并且容易出现网络故障),但它可以保证您开始使用 AzCopy 时,容器将为空。

关于azure - 我是否可以对 Azure 存储进行 API 调用来判断我的容器是否已被删除?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55214640/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com