首页 > 解决方案 > 删除 Azure 文件共享中的文件失败,错误:指定的资源是只读的,此时无法修改

问题描述

尝试删除 Azure 存储文件共享中的文件时。我不断收到以下错误:

无法删除文件“cs-firstName-lastname-domain-com-10033fff99999999/mslearn-my-app-folder-word-and-word-wd/.git/objects/pack/pack-someguid.idx”。错误:指定的资源是只读的,此时不能修改

试图检查是否有任何当前打开的句柄,但我没有看到。 https://docs.microsoft.com/en-us/rest/api/storageservices/list-handles

<?xml version="1.0" encoding="utf-8"?>
<EnumerationResults>
    <Entries />
    <NextMarker />
</EnumerationResults>

此外,我尝试通过运行 powershell cmdlet New-PSDrive从 Windows 连接到此 Azure 文件共享,但也在那里使用Remove-Item,得到以下错误

Remove-Item : Cannot remove item
Z:\mslearn-my-app-folder-word-and-word-wd/.git/objects/pack/pack-someguid.idx: **You
do not have sufficient access rights to perform this operation**.

任何帮助,关于如何从只读更改属性/如何删除/或我缺少的任何内容。

谢谢,

标签: azureazure-storageazure-storage-files

解决方案


正如@BhargaviAnnadevara-MSFT 共享的链接中所述,https: //social.msdn.microsoft.com/Forums/en-US/6fde433a-aef0-49e9-8568-2aaf5a9b673a/unable-to-delete-a-file- from-azure-file-storage?forum=windowsazuredata只读属性只能在安装后删除,我做了以下操作。

  1. 使用 Azure 门户中提供的脚本装载文件共享
  2. 挂载后,执行ls命令将显示文件属性
  3. 在 powershell 或 CMD 中更改文件属性。我发现通过 powershell 很难做到这一点,所以改用 ATTRIB cmd。属性包-someguid.idx -R

更新:更简单的解决方案


https://docs.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-windows#mount-the-azure-file-share-with-file-explorer


推荐阅读