Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3k forks source link

Unable to move blob to virtual directory with `az storage fs file move` #27800

Open williamoconnorme opened 1 year ago

williamoconnorme commented 1 year ago

Describe the bug

When attempting to move a blob file within the same container to a new virtual path, an error is returned regarding its parent directory not existing. Blobs can only be moved to the root of the container

Command toe reproduce: az storage fs file move --file-system "myContainer" --path "myfile.json" --new-path "myContainer/myFolder/myfile.json

Related command

az storage fs file move

Errors

The parent directory of the destination path does not exist. ErrorCode:RenameDestinationParentPathNotFound

Issue script & Debug output

az storage fs file move --file-system "myContainer" --path "myfile.json" --new-path "myContainer/myFolder/myfile.json

Expected behavior

File should be moved/renamed with virtual path prefixed.

Environment Summary

{ "azure-cli": "2.53.1", "azure-cli-core": "2.53.1", "azure-cli-telemetry": "1.1.0", "extensions": { "aks-preview": "0.5.161", "azure-devops": "0.25.0", "interactive": "0.5.3", "storage-preview": "0.8.3" } }

Additional context

The documentation for az storage blob move states that az storage fs file move should be used as the former command is deprecated however there is not parity in functionality when moving a blob from one path to another virtual directory.

https://learn.microsoft.com/en-us/cli/azure/storage/blob?view=azure-cli-latest#az-storage-blob-move

yonzhan commented 1 year ago

Thank you for opening this issue, we will look into it.

calvinhzy commented 12 months ago

I think the default behavior would not create a new directory . Can you first run az storage fs directory create --account-name storageaccountname --file-system containername -n myFolder image