Skip to content

Different behavior on Linux vs. Windows for passing "*" to az cli #24170

@onionhammer

Description

@onionhammer

Prerequisites

Steps to reproduce

  1. Create a powershell script which passes variable to the "--pattern" argument to az storage blob upload-batch
  2. Set pattern variable to "" or "`"
  3. Run script on Windows: Voila it works
  4. Run script on Linux: It finds no files
  5. Hard-code the "*" into the "--pattern" argument on Linux, it works

There does not appear to be a way to pass "*" as variable to az storage blob upload-batch on linux, only hardcode it as a parameter; this behavior works as-expected on Windows.

Expected behavior

$Path = "`*"
      az storage blob upload-batch `
        --auth-mode login `
        --pattern $Path `
        -s "." `
        -d $dest

# Should upload all files in a directory and return a list of files; i.e. ['file1.txt']

Actual behavior

$Path = "`*"
      az storage blob upload-batch `
        --auth-mode login `
        --pattern $Path `
        -s "." `
        -d $dest

# Actually returns [] or no output on Linux, but on Windows works consistently

      az storage blob upload-batch `
        --auth-mode login `
        --pattern '*' `
        -s "." `
        -d $dest

# Works fine

Error details

No errors

Environment data

pwsh --version
PowerShell 7.4.4

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions