gpt4 book ai didi

azure - 批量更改 Azure Blob 存储的层

转载 作者:行者123 更新时间:2023-12-01 12:09:04 24 4
gpt4 key购买 nike

我有数千个具有给定后缀的 blob,我想批量分配给新层(热归档)。我知道可以手动更改门户上的层或通过指向特定 blob 的 REST 请求。有没有办法使用通配符或类似的东西批量设置层?

最佳答案

真的很简单,只需 3 行。

#Get stroage account 
$straccount = Get-AzureRmStorageAccount -Name xxxxxx -ResourceGroupName xxxxxxxxxxxxx

#Get all the blobs in container
$blobs = Get-AzureStorageBlob -Container test -Context $straccount.Context

#Set tier of all the blobs to Archive
$blobs.icloudblob.setstandardblobtier("Archive")

只需确保容器中只有 block blob,否则会出现错误。最后我检查了存档层仅受 block blob 支持。

https://learn.microsoft.com/en-us/dotnet/api/microsoft.windowsazure.storage.blob.cloudblockblob?view=azure-dotnet

希望这有帮助。

关于azure - 批量更改 Azure Blob 存储的层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53800138/

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