Azure / azure-cli

Azure Command-Line Interface
MIT License
3.97k stars 2.95k forks source link

azure-cli-2.51.0.msi upgrade from previous version 2.50.0 no longer non-interactive. #27053

Open aluty opened 1 year ago

aluty commented 1 year ago

Describe the bug

  1. Package name change.

BEFORE: PS> Get-Package -ProviderName msi -Name 'Microsoft Azure CLI'

AFTER: Get-Package -ProviderName msi -Name 'Microsoft Azure CLI (32-bit)'

Name Version Source ProviderName


Microsoft Azure CLI 2.50.0 msi
Microsoft Azure CLI (32-bit) 2.51.0 msi

  1. Upgrade from previous version 2.50.0 no longer non-interactive. CMD> az upgrade --all --yes

Related command

az upgrade --all --yes

Errors

No error, just change in update behavior.

Issue script & Debug output

<# .SYNOPSIS Installs Azure CLI (Command Line Interface). .NOTES How to install the Azure CLI & Start-Process https://learn.microsoft.com/en-us/cli/azure/install-azure-cli

>

Import-Module -Name PackageManagement -ErrorAction Stop

$az = "${env:ProgramFiles(x86)}\Microsoft SDKs\Azure\CLI2\wbin\az.cmd" $msiFile = "${env:USERPROFILE}\Downloads\AzureCLI.msi" if (-not (Test-Path -Path $az -PathType Leaf)) {

Write-Warning -Message "Install Azure CLI?" -WarningAction Inquire

Invoke-WebRequest -Uri 'https://aka.ms/installazurecliwindows' -OutFile $msiFile -Verbose
Install-Package -ProviderName msi -Name $msiFile -Verbose

} Get-Package -ProviderName msi -Name 'Microsoft Azure CLI' -Verbose | Format-Table -AutoSize

$azDevopsInstalled = & $az extension list --query "[? name == 'azure-devops']" | ConvertFrom-Json | Select-Object -First 1 if (-not $azDevopsInstalled) {

Add the Azure DevOps extension

& $az extension add --name azure-devops

}

NOTE: Avoid stop on error due to stderr: This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus

$ErrorActionPreferenceBackup = $ErrorActionPreference try { $ErrorActionPreference = [System.Management.Automation.ActionPreference]::SilentlyContinue & $az upgrade --all --yes } finally { $ErrorActionPreference = $ErrorActionPreferenceBackup }

& $az version

Expected behavior

Silent upgrade from 2.50.0 to 2.51.0

az upgrade --all --yes

Environment Summary

CMD> az --version

azure-cli                         2.51.0

core                              2.51.0
telemetry                          1.1.0

Extensions:
azure-devops                      0.26.0

Dependencies:
msal                            1.24.0b1
azure-mgmt-resource             23.1.0b2

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Extensions directory 'C:\Users\Administrator\.azure\cliextensions'

Python (Windows) 3.10.10 (tags/v3.10.10:aad5f6a, Feb  7 2023, 17:05:00) [MSC v.1929 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.

Additional context

No response

yonzhan commented 1 year ago

Thank you for opening this issue, we will look into it.

jiasli commented 1 year ago

The product name change from Microsoft Azure CLI to Microsoft Azure CLI (32-bit) is expected according to https://github.com/Azure/azure-cli/pull/26640#issuecomment-1660054026.

az upgrade is never meant to be non-interactive as no /q or /quiet argument is given when invoking msiexec.exe:

https://github.com/Azure/azure-cli/blob/21266e02457263420b62fba1c529f69e28852414/src/azure-cli/azure/cli/command_modules/util/custom.py#L193

It will always prompt for the MSI installation window:

image

I doubt in your previous executions, there is no update available. The output of az upgrade --all --yes should look like:

> az upgrade --all --yes
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
You already have the latest azure-cli version: 2.51.0
Upgrade finished.You can enable auto-upgrade with 'az config set auto-upgrade.enable=yes'. More details in https://docs.microsoft.com/cli/azure/update-azure-cli#automatic-update

See: