1
votes

While trying to delete a file in the Azure Storage File Share. I continuously get following error:

Failed to delete file 'cs-firstName-lastname-domain-com-10033fff99999999/mslearn-my-app-folder-word-and-word-wd/.git/objects/pack/pack-someguid.idx'. Error: The specified resource is read-only and cannot be modified at this time

Tried to check if there are any current open handles but I see none. https://docs.microsoft.com/en-us/rest/api/storageservices/list-handles

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

Also, I tried to connect to this Azure file share from Windows by running powershell cmdlet New-PSDrive, but there too and using Remove-Item, getting below error

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**.

Any help, about how to change the property from read-only/ how can I delete/ or anything which I am missing.

Thanks,

1
The file is most likely locked by another process.Daniel Björk
@DanielBjörk yes, that was the thought when tried to list handles. Any other way ?Prerak K
@BhargaviAnnadevara-MSFT yes, I had stumbled on it and thats why tried the new-psdrive , a script is provided from within azure portal.Prerak K
@BhargaviAnnadevara-MSFT I will try to change the file attribute once mounted. earlier I was directly issuing a delete command. ThanksPrerak K

1 Answers

0
votes

As mentioned in the link shared by @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 The read-only attribute can be removed only once mounted, I did following.

  1. Mounted the File Share using the script provided in the Azure portal
  2. Once mounted, doing a ls command will show the file attributes
  3. In powershell or CMD change the file attribute. I found it hard to do it via powershell so instead used ATTRIB cmd. attrib pack-someguid.idx -R

Update : Easier Solution


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