Azure / Azure/azure-cli

az storage file upload path with file name in it no longer works

Open
#32,815 4 comments 0 reactions 1 assignee Assigned to @calvinhzy View on GitHub
act-codegen-extensibility-squad Auto-Assign Auto-Resolve Azure CLI Team Breaking Change customer-reported question Storage
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

### Describe the bug

az cli might have a bug when doing a storage file upload using a [DEST_FILE_NAME] in the path.

The [documentation](https://learn.microsoft.com/en-us/cli/azure/storage/file?view=azure-cli-latest#az-storage-file-upload) says : _--path -p The path to the file within the file share. If the file name is omitted, the source file name will be used._

If a [DEST_FILE_NAME] is not in the path, it works as intended.

When using a [DEST_FILE_NAME] in the path, az cli thinks the [DEST_FILE_NAME] is a directory, and as it does not exist (because I want it to be the file name), az cli says the _"The specified parent path does not exist"_.

### Related command

Command that no longer works (should work as per the documentation) :
```
az storage file upload \
--account-name "[STORAGE_ACCOUNT_NAME]" \
--share-name "[FILE_SHARE_NAME]" \
--path "[FILE_SHARE_DIRECTORY_PATH]/[DEST_FILE_NAME]" \
--source "[LOCAL_DIRECTORY_PATH]/[SRC_FILE_NAME]" \
--enable-file-backup-request-intent \
--auth-mode login
```

Command that works as intended (no DEST_FILE_NAME in path) :
```
az storage file upload \
--account-name "[STORAGE_ACCOUNT_NAME]" \
--share-name "[FILE_SHARE_NAME]" \
--path "[FILE_SHARE_DIRECTORY_PATH]" \
--source "[LOCAL_DIRECTORY_PATH]/[SRC_FILE_NAME]" \
--enable-file-backup-request-intent \
--auth-mode login
```

### Errors

The specified parent path does not exist.
ErrorCode:ParentNotFound

### Issue script & Debug output

/

### Expected behavior

The az storage file upload should work with or without a DEST_FILE_NAME in the path.

### Environment Summary

azure-cli 2.77.0 as it was the LTS version before the new STS support lifecycle.
python 3.12

### Additional context

My script using the command with DEST_FILE_NAME was working weeks ago. It no longer works now.

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.