Open alexander-kastil opened 6 months ago
Thank you for opening this issue, we will look into it.
The auto-upgrade happens when the current command exits successfully. It cannot detect if you are executing a series of commands. I'm not certain how the auto-upgrade interrupts your script, but you can easily disable it.
I have a bunch of Azure CLI Scripts just like this one ... Use VS Code and the Azure CLI Extension and the Run Line in Terminal command, and it happened several times that in the middle of the commands the CLI started upgrading. Certainly it could disable it ...
env=$RANDOM grp=az204-m02-foodpics-$env loc=westeurope acct=foodpics$env container="food" blob_name=shrimp-vindaloo.jpg file_to_upload="./food-pics/shrimp-vindaloo.jpg" destination_file="./downloaded/shrimp-vindaloo.jpg"
az group create -n $grp -l $loc
az storage account create -l $loc -n $acct -g $grp --sku Standard_LRS
key=$(az storage account keys list -n $acct --query "[0].value" -o tsv)
az storage container create -n $container --account-key $key --account-name $acct
az storage blob upload --container-name $container --file $file_to_upload --name $blob_name --account-key $key --account-name $acct
az storage blob list --container-name $container --output table --account-name $acct --account-key $key
az storage blob download --container-name $container --name $blob_name --file $destination_file --output table --account-key $key --account-name $acct
conStr=$(az storage account show-connection-string -n $acct -g $grp --query connectionString -o tsv)
sed -i "s/
echo "storage connection string: " $conStr
I can't repro. Auto-upgrade does not change the stdout and exit code. You need to investigate what happens when auto-upgrade is triggered in your machine.
Maybe I forgot to mention that I am executing agains WSL Ubuntu 20.x… Not as a script but piping it from an opened script using Azure CLI Tools VS Code Ext & run selected lines in terminal …. Happened to me 4 times … Could you provide a command I could execute to collect data if it happens again? I‘m sure it will happen again
Simply downgrade CLI and then run your scrip step by step, then you should be able to repro it locally. Pay attention to the output and the step it fails.
Is your feature request related to a problem? Please describe. I have automatic upgrades for azure cli enabled ... up to now it happened 3 times to me that the upgrade started in the middle of a batch of commands which were saved as a script. after the upgrade the script did not resume and I had to run it again, and if there were random parts in the script I had to clean up the whole environment. This always happend while using WSL
Describe the solution you'd like Implement a solution that the cli does not upgrade itself while executing a batch of commands (script)