Azure / Azure/azure-cli

Support renaming files in directories in `az storage`

Open
#31,578 1 comment 2 reactions 3 assignees Claimed by @jiasli View on GitHub
act-codegen-extensibility-squad Auto-Assign Azure CLI Team customer-reported feature-request needs-team-triage Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Related command**
`az storage file` and `az storage directory`

**Is your feature request related to a problem? Please describe.**
The missing `rename` operation is very common and would make for a great feature that completes the rest of the commands.

**Describe the solution you'd like**
The [`az storage file`](https://learn.microsoft.com/en-us/cli/azure/storage/file?view=azure-cli-latest) and [`az storage directory`](https://learn.microsoft.com/en-us/cli/azure/storage/directory?view=azure-cli-latest) utilities should include a `rename` operation.

**Describe alternatives you've considered**
The alternatives are to either:
* Using the REST API which provides [`Rename File`](https://learn.microsoft.com/en-us/rest/api/storageservices/rename-file) and [`Rename Directory`](https://learn.microsoft.com/en-us/rest/api/storageservices/rename-directory).
* Setting up Azure PowerShell which provides [`Rename-AzStorageFile`](https://learn.microsoft.com/en-us/powershell/module/az.storage/rename-azstoragefile?view=azps-12.5.0) and [`Rename-AzStorageDirectory`](https://learn.microsoft.com/en-us/powershell/module/az.storage/rename-azstoragedirectory?view=azps-12.5.0).

**Additional context**
Renaming a directory through the REST API is much less convenient than any of the `storage` commands:
```sh
az rest --method put \
--headers "{ \
\"x-ms-version\": \"2024-11-04\", \
\"x-ms-file-rename-source\": \"$SOURCE_DIR\", \
\"x-ms-file-request-intent\": \"backup\" }" \
--url "$TARGET_DIR"'?restype=directory&comp=rename' \
--resource "$SHARE_URL"
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.