diff --git a/linux/powershell/PSCloudShellStartup.ps1 b/linux/powershell/PSCloudShellStartup.ps1 index 68d38d6d..7f418e4e 100644 --- a/linux/powershell/PSCloudShellStartup.ps1 +++ b/linux/powershell/PSCloudShellStartup.ps1 @@ -40,6 +40,7 @@ Microsoft.PowerShell.Core\Import-Module Az.Tools.Predictor -Force # Using the new set of az cmdlets Microsoft.PowerShell.Core\Import-Module Az.Accounts +Az.Accounts\Update-AzConfig -CheckForUpgrade $false -Scope Process | Microsoft.PowerShell.Core\Out-Null Az.Accounts\Enable-AzureRmAlias # On Linux, we are not loading the profile from the clouddrive since we are already mounted on the Linux OS image: \clouddrive\.cloudconsole\acc_.img diff --git a/linux/tools.Dockerfile b/linux/tools.Dockerfile index fbfe1c4a..8d46ace4 100644 --- a/linux/tools.Dockerfile +++ b/linux/tools.Dockerfile @@ -98,9 +98,19 @@ RUN mkdir -p /usr/cloudshell WORKDIR /usr/cloudshell # Powershell telemetry -ENV POWERSHELL_DISTRIBUTION_CHANNEL=CloudShell \ - # don't tell users to upgrade, they can't - POWERSHELL_UPDATECHECK=Off +ENV POWERSHELL_DISTRIBUTION_CHANNEL=CloudShell + +# Disable update checks for tools managed by Cloud Shell. +# CHECKPOINT_DISABLE is for Terraform. +ENV CHECKPOINT_DISABLE=1 \ + POWERSHELL_UPDATECHECK=Off \ + GH_NO_UPDATE_NOTIFIER=1 \ + GH_NO_EXTENSION_UPDATE_NOTIFIER=1 \ + NPM_CONFIG_UPDATE_NOTIFIER=false \ + PIP_DISABLE_PIP_VERSION_CHECK=1 \ + CLIMICROSOFT365_NOUPDATE=1 \ + DOTNET_CLI_WORKLOAD_UPDATE_NOTIFY_DISABLE=true \ + AZURE_BICEP_CHECK_VERSION=false # Copy and run script to install Powershell modules and setup Powershell machine profile COPY ./linux/powershell/ powershell diff --git a/tests/PSinLinuxCloudShellImage.Tests.ps1 b/tests/PSinLinuxCloudShellImage.Tests.ps1 index 63251791..9c818cf9 100755 --- a/tests/PSinLinuxCloudShellImage.Tests.ps1 +++ b/tests/PSinLinuxCloudShellImage.Tests.ps1 @@ -82,6 +82,13 @@ Describe "Various programs installed with expected versions" -Tag "CloudShellUse It "Has various environment vars" { $env:AZUREPS_HOST_ENVIRONMENT | Should-Be "cloud-shell/1.0" } + + It "Disables update checks for managed PowerShell components" { + $env:POWERSHELL_UPDATECHECK | Should-Be "Off" + $config = Az.Accounts\Get-AzConfig -CheckForUpgrade + $config.Value | Should-BeFalse + $config.Scope | Should-Be "Process" + } } Describe "PowerShell Modules" {