You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running az --version an update check is performed against az-cli and the extensions.
Azure Pipelines' AzureCLI task runs az --version to capture the version details in the logs.
It would save quite a bit of CPU if az-cli would not perform an update check in a CI/CD scenario.
There already is an core.auto-upgrade=false option, would it not make sense to piggy back on that or to add another config setting to turn off update checking.
Related command
az --version
Errors
N/a
Issue script & Debug output
N/a
Expected behavior
No update check is performed in CI.
Environment Summary
2.52.0
Additional context
No response
Reacted by Michael van Rooijen, Jeroen and David Wales
We do have az version command that doesn't make any network request (#27457 (comment)). I think what you are asking for is an option to disable update check in az --version, while #27457 asks for an option to enable version check in az version. 🤣
Yeah, have a way to disable network access for these commands. Either with an extra parameter to --check-updates true or a setting in the config file or an environment variable.
Ideally az would detect it's in CI/CD and turn off a load of stuff that only adds logspam and slowdowns by default.
It looks like az init is making a start of collecting the desired settings ;).
Ideally az would detect it's in CI/CD and turn off a load of stuff that only adds logspam and slowdowns by default.
This is another topic we are still internally investigating. Not only Azure DevOps, we are aiming to find a unified way to detect the running environment - Azure DevOps, Azure Cloud Shell, GitHub Actions, etc.
az init is only an experimental feature we made in Azure/azure-cli-extensions#3969. It is never expected to be used in production. Also, az init allows the user to select the running environment. It can't really detect the running environment.
az init is only an experimental feature we made in Azure/azure-cli-extensions#3969. It is never expected to be used in production. Also, az init allows the user to select the running environment. It can't really detect the running environment.
Yeah, I figured as much. The experimental nature at least. But it does seem to reccomend certain settings in an automated environment.
As you mentioned above auto-upgrade.enable=yes in the docs turns out to probably be auto-upgrade.enable=true in the code, at least there are quite a few issues that dispute the correct syntax. I went looking for what settings there are and what their values should/could be and there is VERY little documentation on those topics.
I ended up doing a search through the codebase instead. But it lead to some useful insights!
I've been digging into the performance of az and az devops in Azure Pipelines and GtHub Hosted Runners.
If these each shave off a couple of seconds, over the number of invocations on the hosted runners worldwide it would save a couple of trees and a bunch of water.
Ideally az would detect it's in a CI/CD environment and turn off:
Telemetry
Disk logging
Error recommendations
Colors
Auto-updates
Version checks
Survey banners
auto-installation of missing extensions
Randomly downloading new pip packages (like keyring) or helm versions or other unexpectedly missing dependencies. I'd rather have it fail in CI/CD than for it to download versions of files I haven't been able to vet.
Activity
yonzhan commentedon Sep 20, 2023
Thank you for opening this issue, we will look into it.
jiasli commentedon Sep 28, 2023
According to https://learn.microsoft.com/en-us/cli/azure/update-azure-cli#automatic-update, it should be
auto-upgrade.enable=yes.We do have
az versioncommand that doesn't make any network request (#27457 (comment)). I think what you are asking for is an option to disable update check inaz --version, while #27457 asks for an option to enable version check inaz version. 🤣jessehouwing commentedon Sep 28, 2023
Yeah, have a way to disable network access for these commands. Either with an extra parameter to
--check-updates trueor a setting in the config file or an environment variable.Ideally
azwould detect it's in CI/CD and turn off a load of stuff that only adds logspam and slowdowns by default.It looks like
az initis making a start of collecting the desired settings ;).jiasli commentedon Sep 28, 2023
az initis actually a secret project. May I know where you heard of it? 🤣jessehouwing commentedon Sep 28, 2023
I was looking for a way to set the default config settings, and I tried it on the console. Lo and behold it downloaded the extension and ran.
I supplied a PR for it to add a few more settings.
jiasli commentedon Sep 28, 2023
This is another topic we are still internally investigating. Not only Azure DevOps, we are aiming to find a unified way to detect the running environment - Azure DevOps, Azure Cloud Shell, GitHub Actions, etc.
jiasli commentedon Sep 28, 2023
az initis only an experimental feature we made in Azure/azure-cli-extensions#3969. It is never expected to be used in production. Also,az initallows the user to select the running environment. It can't really detect the running environment.jessehouwing commentedon Sep 28, 2023
Yeah, I figured as much. The experimental nature at least. But it does seem to reccomend certain settings in an automated environment.
As you mentioned above
auto-upgrade.enable=yesin the docs turns out to probably beauto-upgrade.enable=truein the code, at least there are quite a few issues that dispute the correct syntax. I went looking for what settings there are and what their values should/could be and there is VERY little documentation on those topics.I ended up doing a search through the codebase instead. But it lead to some useful insights!
I've been digging into the performance of
azandaz devopsin Azure Pipelines and GtHub Hosted Runners.az --versionfrom AzureCLI microsoft/azure-pipelines-tasks#19006 & [AzureCLIV2] Replacesaz --versionwithaz versionmicrosoft/azure-pipelines-tasks#19039.azure-devopscache folder microsoft/azure-pipelines-tasks#19007az --helpcauses a command index rebuild #27444If these each shave off a couple of seconds, over the number of invocations on the hosted runners worldwide it would save a couple of trees and a bunch of water.
Ideally
azwould detect it's in a CI/CD environment and turn off:And would allow:
AZURE_AUTO-UPGRADE_ENABLEis not a valid env var name on Linux #19200)