azure-cli: Unsupported API version '2020-04-01' for Network Resource. MS is fixing it.

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug

CLI 2.7.0 fails to run command az network vnet show

To Reproduce

sudo apt-get install -y apt-transport-https
# https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-apt?view=azure-cli-latest
curl -sL https://packages.microsoft.com/keys/microsoft.asc |
    gpg --dearmor |
    sudo tee /etc/apt/trusted.gpg.d/microsoft.asc.gpg > /dev/null

##### git bash for windows based on Ubuntu
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
sudo apt-get update
sudo apt-get install ca-certificates curl apt-transport-https lsb-release gnupg

AZ_REPO=$(lsb_release -cs)
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ $AZ_REPO main" | 
    sudo tee /etc/apt/sources.list.d/azure-cli.list

sudo apt-get update
apt search azure-cli 
apt-cache search azure-cli 
apt list azure-cli -a
sudo apt-get install azure-cli # azure-cli=2.5.0-1~bionic
sudo apt-get update && sudo apt-get install --only-upgrade -y azure-cli
sudo apt-get upgrade azure-cli
az login

az vm create --name $bastion_name \
    --image UbuntuLTS \
    --admin-username $bastion_admin_username \
    --resource-group $rg_bastion_name \
    --vnet-name $vnet_bastion_name \
    --subnet ManagementSubnet \
    --nsg $b_nsg \
    --size Standard_B1s \
    --zone 1 \
    --location $location \
    --ssh-key-values ~/.ssh/$ssh_key.pub

vnet_id=$(az network vnet show --resource-group $rg_name --name $vnet_name --query id -o tsv)
echo "VNet Id :" $vnet_id	

master_subnet_id=$(az network vnet subnet show --name $master_subnet_name --vnet-name $vnet_name  -g $rg_name --query id -o tsv)
echo "Master Subnet Id :" $master_subnet_id	

worker_subnet_id=$(az network vnet subnet show --name $worker_subnet_name --vnet-name $vnet_name -g $rg_name --query id -o tsv)
echo "Worker Subnet Id :" $worker_subnet_id	

ilb_subnet_id=$(az network vnet subnet show --resource-group $rg_name --vnet-name  $vnet_name --name $ilb_subnet_name --query id -o tsv)
echo "Internal Load BalancerLB Subnet Id :" $ilb_subnet_id	

bastion_vnet_id=$(az network vnet show --name $vnet_bastion_name -g $rg_bastion_name --query id -o tsv)
echo "Bastion VNet Id :" $bastion_vnet_id	

bastion_subnet_id=$(az network vnet subnet show --name $subnet_bastion_name --vnet-name $vnet_bastion_name -g $rg_bastion_name --query id -o tsv)
echo "Bastion Subnet Id :" $bastion_subnet_id	

acr_registry_id=$(az acr show --name $acr_registry_name --resource-group $rg_name --query "id" --output tsv)
echo "ACR registry ID :" $acr_registry_id

Expected behavior

az network vnet show command should run successfully

Environment summary

az version { “azure-cli”: “2.7.0”, “azure-cli-command-modules-nspkg”: “2.0.3”, “azure-cli-core”: “2.7.0”, “azure-cli-nspkg”: “3.0.4”, “azure-cli-telemetry”: “1.0.4”, “extensions”: {} }

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 14
  • Comments: 25 (6 by maintainers)

Most upvoted comments

I have the same issue with publicIPAddresses.

When can we expect a fix and is there a workaround?

I believe this issue should be fixed soon.

A workaround is to use old version of Azure CLI. Please uninstall the 2.7.0 and install any older version. It uses 2020-03-01 api-version or before which are not affected.

Microsoft has fixed the problem on Azure backend side. For me az cli 2.7.0 (on Ubuntu 20.04) seems to work again!

PRELIMINARY ROOT CAUSE: Engineers determined that a recent deployment contained a configuration bug, which caused requests through the ARM deployment and management service to fail. MITIGATION: Engineers rolled back the faulty configuration safely, which mitigated the issue.

Thanks for the help @MyronFanQiu , I am trying to figure out if there is a way I can specify an older version with this command for Ubuntu and Debian curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

Hi. Installation method for old version in any platform can be found from here

A workaround is to use old version of Azure CLI. Please uninstall the 2.7.0 and install any older version. It uses 2020-03-01 api-version or before which are not effected.

Where can I find a MSI file for version 2.6.0? How do I install an older version? It’s not described in the documentation.

For Windows, please use this script in powershell to install previous version such as 2.6.0.

Invoke-WebRequest -Uri https://azurecliprod.blob.core.windows.net/msi/azure-cli-2.6.0.msi -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi

You can also download other older versions through

https://azurecliprod.blob.core.windows.net/msi/azure-cli-2.6.0.msi

Sorry for the inconvenience.