Azure / Azure/azure-cli

`az redis export` command returning parsing errors on PowerShell after `2.40.0` azure-cli version

Open
#24,617 4 comments 0 reactions 0 assignees View on GitHub
act-codegen-extensibility-squad Auto-Assign Redis Cache Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 10h
Merged PRs (30d)
64

Description

**Related command**
`az redis export`

**Describe the bug**
After upgrading to azure-cli version greater than `2.40.0` the `az redis export` command is failing with the following parsing error:
```
PS C:\Users\austintolani> az redis export --container "" --prefix "prefix" -g -n --file-format rdb
the following arguments are required: --prefix
```
I believe that this issue is due to the ampersand issue described [here](https://github.com/Azure/azure-cli/blob/dev/doc/quoting-issues-with-powershell.md#ampersand--is-interpreted-by-command-prompt). Using the stop-parsing token (`--%`) solves the issue.

It looks like this is a PowerShell issue being tracked at https://github.com/PowerShell/PowerShell/issues/1995 but I'm not sure what changes were introduced in `2.41.0` that would result in different behavior. Runing the identical command on PowerShell with version `2.40.0` does not produce any errors. Looking at the r[elease notes for 2.41.0](https://learn.microsoft.com/en-us/cli/azure/release-notes-azure-cli#october-11-2022) I cannot see any related changes.
**To Reproduce**

1. Create a premium Redis cache
2. Create a container in storage account and copy the SAS URL
3. Run the `az redis export` command with a version of azure-cli `2.41.0` or greater on PowerShell

**Expected behavior**
`az redis export` command, when passed a valid container URL, should not return any parsing errors
**Environment summary**

Install method - MSI
CLI version - 2.41.0,2.42.0
Shell Type - PowerShell

Contributor guide

Open the contributing guide

Research direction

Start with the `az redis export` command entry point and compare its argument handling between Azure CLI 2.40.0 and 2.41.0 or later, focusing on the PowerShell ampersand behavior described in the issue. Reproduce the command with a SAS URL in PowerShell; done means a valid container URL no longer causes the `--prefix` parsing error.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, powershell, python, redis
Domain
cli, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.