Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use az upgrade in quiet mode #16617

Open
cnovel opened this issue Jan 21, 2021 · 18 comments
Open

Use az upgrade in quiet mode #16617

cnovel opened this issue Jan 21, 2021 · 18 comments
Assignees
Milestone

Comments

@cnovel
Copy link

cnovel commented Jan 21, 2021

Is your feature request related to a problem? Please describe.
I'd like to use az upgrade without the need of human intervention on Windows.
Currently, running az upgrade -y --all still prompts a dialog where you have to accept license and click on next.

Describe the solution you'd like
az upgrade --yes --all --quiet upgrades all the az cli quietly, without any dialog or human interaction.

Describe alternatives you've considered
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi would be doable, but it is way less elegant, and not cross platform. Scratch that, I just tried and it doesn't work for updating from 2.16.0 to 2.18.0.

@ghost ghost added needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Jan 21, 2021
@yungezz yungezz added the Upgrade az upgrade label Jan 21, 2021
@ghost ghost removed the needs-triage This is a new issue that needs to be triaged to the appropriate team. label Jan 21, 2021
@yungezz
Copy link
Member

yungezz commented Jan 21, 2021

hi @fengzhou-msft could you pls share the config to silently upgrade? thanks

@fengzhou-msft
Copy link
Member

fengzhou-msft commented Jan 27, 2021

You can use --only-show-errors to suppress warnings and infos from Azure CLI. But admin privilege is needed with user confirmation or password when updating MSI, Debian and RPM packages.

BTW, for the command to update MSI quietly, you need to start the Powershell as admin.

@abhi-msft
Copy link

abhi-msft commented Jul 15, 2021

@fengzhou-msft I tried using PS and CMD as admin and ran the below without success.
az upgrade -y --all --only-show-errors
and
az upgrade -y --only-show-errors

It started the MSI dialog and asked me to accept the license and click next to continue as mentioned in the issue description.

@jiasli jiasli assigned jiasli and unassigned fengzhou-msft Jul 15, 2021
@jiasli jiasli reopened this Jul 15, 2021
@jiasli jiasli added this to the Backlog milestone Jul 15, 2021
@jiasli jiasli modified the milestones: Backlog, Aug 2021 (2021-09-07) Aug 13, 2021
@sburbano
Copy link

sburbano commented May 5, 2022

@jiasli Any updates on this issue?

I'm trying to setup an automated process to update our self-hosted Azure DevOps agents. This 'accept license->next' is the only stopper that remains for us.

Thx

@yonzhan yonzhan removed the question The issue doesn't require a change to the product in order to be resolved. Most issues start as that label May 5, 2022
@celluj34
Copy link

Same here. I need the ability to update agents without user interaction.

@fridrichovsky
Copy link

Hello,
I have same problem. I am using multiple agents and I need uprade azure client there automatically without use interaction. There is no problem run powershell as administrator.

@geidans
Copy link

geidans commented Oct 1, 2022

Same here. Managing servers where Azure CLI needs updating is nightmare - cannot be automated.

@ncook-hxgn
Copy link

Yes please. Probably we need an accepteula or something too

az upgrade -y --all --only-show-errors --accepteula

Ubuntu users get to install and update az via apt. No fair :(
winget?

@bebound
Copy link
Contributor

bebound commented Mar 2, 2023

I need to fix #22741 first.

@bebound
Copy link
Contributor

bebound commented May 19, 2023

Reviewing this issue again, I found that the UAC windows during installation is required for non-admin user.
This is a OS behavior, we have nothing to do about it. You can the disccusion in winget: microsoft/winget-cli#218
So adding this parameter is not of much use.

For admin user, you can use this command to update CLI to latest version without prompt, then run az upgrade again to update extensions.
$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; Remove-Item .\AzureCLI.msi

Ref:
https://review.learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?branch=live&tabs=powershell#powershell

@ncook-hxgn
Copy link

@bebound the problem is that even an admin user using the CLI must still check a box in a dialog to accept the license, which means admin users can't automate the use of the CLI to update update az across multiple machines with e.g. Invoke-Command, or even something more complex like ansible. That's why we need an --accepteula, like SysInternals and many other things: to prevent the need for a dialog, not to avoid UAC.

@bebound
Copy link
Contributor

bebound commented May 22, 2023

@ncook-hxgn Hey, I update my previous comment a bit. Does this command solve the problem?

@ncook-hxgn
Copy link

@bebound I'll give it a go, but it feels like a workaround

@toby-freemarket
Copy link

This is very annoying, I can't update all my agents remotely.
It's devops now days not clickops!

@bebound
Copy link
Contributor

bebound commented Jun 2, 2023

@toby-freemarket Please try #16617 (comment)

@jasonfy2k
Copy link

@toby-freemarket Please try #16617 (comment)

I've tried this command as admin, but it doesn't work. The msiexec process starts, but it seems to hang and never actually installs/updates anything, and eventually dies.

@bebound
Copy link
Contributor

bebound commented Jun 6, 2023

@jasonfy2k This should not happen. Do you have any system policy prevents the MSI installation, are you able to install the MSI manually as admin?

@jasonfy2k
Copy link

@bebound my mistake, I was running the process under the wrong user. It would still be nice to have a native flag built-in to handle this, but your solution works for me, thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests