简体   繁体   English

如何使用 c# 从 Azure 中删除 blob 不可变文件

[英]How to delete blob immutable file from Azure using c#

I have a file in Azure blob stroage with legal hold policy.我在 Azure blob stroage 中有一个具有合法保留政策的文件。 When am trying to delete that file, I am getting msg "blobImmutableDueToLegalHold".当我试图删除该文件时,我收到消息“blobImmutableDueToLegalHold”。 I am trying to achieve task by using c#我正在尝试通过使用 c# 来完成任务

In general this occurs when the operation is not permitted as the blob is immutable due to one or more legal holds.通常,当不允许操作时会发生这种情况,因为由于一个或多个合法保留,该 blob 是不可变的。

In order to resolve you need to create an immutable policy through portal/sdks.为了解决您需要通过门户/SDK 创建不可变策略。 You can enable immutable policy for the container or for the whole storage account.您可以为容器或整个存储帐户启用不可变策略。 For Storage account, you can navigate to Dataprotection and check Enable version-level immutability support .对于存储帐户,您可以导航到 Dataprotection 并选中Enable version-level immutability support

在此处输入图像描述

You can even enable this from your cli using您甚至可以使用 cli 从您的 cli 启用此功能

az storage account create \
    --name <storage-account> \
    --resource-group <resource-group> \
    --enable-alw \
    --immutability-period-in-days 90 \
    --immutability-state unlocked \
    --allow-protected-append-writes true

For container you can enable immutable policy by navigating to your container > Access policy > Add policy > Legal hold > ok.对于容器,您可以通过导航到您的容器 > 访问策略 > 添加策略 > 合法保留 > 确定来启用不可变策略。

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

REFERENCES: Configure immutability policies for blob versions参考: 为 blob 版本配置不变性策略

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在c#中从Windows azure中删除blob - Delete a blob from Windows azure in c# 如何使用 C# 中的 Azure.Storage.Blobs 以 ByteArray 格式从 Azure 存储 blob 中获取文件 - How to get file from Azure storage blob in a ByteArray format using Azure.Storage.Blobs in C# 下载 Blob 文件到 Memory Stream 从 Azure 使用 ZD7EFA19FBE74D3972FDZ5ADB6D - Download Blob file into Memory Stream from Azure using C# 如何使用 C# 将文件上传到 Azure Blob 存储? - How to upload file into Azure Blob Storage using C#? 如何从c#中的URL将文件直接上传到azure blob? - How to upload a file directly to azure blob from the URL in c#? 如何使用 c# 从 azure blob 存储中检索 xml 文件 - how to retrieve an xml file from azure blob storage using c# C# 删除 Azure Blob - 无效的 URI - C# Delete Azure Blob - Invalid Uri 使用 C# 在 Azure 存储中设置 blob 的到期日期或在 X 天后自动删除 blob? - Set the expiry date of a blob or auto delete the blob after X number of days in Azure Storage using C#? 如何使用.net SDK(C#)创建Azure搜索索引器以从Azure Blob存储中提取数据 - How to create an Azure Search Indexer using .net SDK (c#) to pull data from Azure blob storage 从HTML网页(C#)将文件上传到Azure Blob吗? - Upload file to Azure Blob from HTML webpage (C#)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM