Azure / Azure/azure-cli

`az --version` shows there are available updates when there is actually not

Open
#24,221 3 comments 0 reactions 2 assignees Claimed by @bebound View on GitHub
act-platform-engineering-squad Auto-Assign Azure CLI Team feature-request Installation Upgrade
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

**Related command**
`az --version`
`az upgrade`

**Describe the bug**
Azure CLI has dropped support for some environments:

- Ubuntu < 18.04, Debian < 10 (https://github.com/Azure/azure-cli/pull/22170)
- CentOS 7, RHEL 7, SUSE (https://github.com/Azure/azure-cli/pull/23047)
- Python < 3.7 (https://github.com/Azure/azure-cli/pull/23102)

However, in those environments, `az --version` still shows there are available updates:

```
[root@ae6b254e11cf /]# az -v
azure-cli 2.38.0 *

core 2.38.0 *
telemetry 1.0.6 *

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Python location '/usr/bin/python3.6'
Extensions directory '/root/.azure/cliextensions'

Python (Linux) 3.6.8 (default, Nov 16 2020, 16:55:22)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

Legal docs and information: aka.ms/AzureCliLegal

You have 3 updates available. Consider updating your CLI installation with 'az upgrade'
```

This because Azure CLI checks the latest version from source code on GitHub repo, instead of corresponding package repo:

https://github.com/Azure/azure-cli/blob/8357f17bdc9abb50e3f97a465943ea8301c925f7/src/azure-cli-core/azure/cli/core/util.py#L299-L303

**To Reproduce**
Lauch a CentOS 7 docker container and install Azure CLI:
```
docker run -it --rm centos:7

rpm --import https://packages.microsoft.com/keys/microsoft.asc

echo -e "[azure-cli]
name=Azure CLI
baseurl=https://packages.microsoft.com/yumrepos/azure-cli
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc" | tee /etc/yum.repos.d/azure-cli.repo

yum install azure-cli

az --version
```

**Expected behavior**
`az --version` shouldn't show available updates in those environments.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.