Azure-cli: Azure Network VPC Peering Create Fails v2.1.6.0

Created on 9 Dec 2020  路  20Comments  路  Source: Azure/azure-cli

Describe the bug
With the new CLI release, vnet peering create returns an error BadRequestError: Cannot parse the request.
Portal Activity logs show full error:

"statusMessage": "{\"error\":{\"code\":\"InvalidRequestFormat\",\"message\":\"Cannot parse the request.\",\"details\":[{\"code\":\"InvalidJson\",\"message\":\"Could not find member 'syncRemoteAddressSpace' on object of type 'VirtualNetworkPeeringProperties'. Path 'properties.syncRemoteAddressSpace', line 1, position 558.\"}]}}",

To Reproduce
az network vnet peering create --name network1 --vnet-name vnet1 --remote-vnet vnet2 --allow-vnet-access --resource-group rg1

Expected behavior
Expected a peering connection to be created.
Environment summary
Azure CLI version 2.16 on Linux

Network OKR3.2 Candidate feature-request

Most helpful comment

Thanks for reporting and we're debugging it now

All 20 comments

network

The same problem appears when working in the Sandbox on Microsoft learn:
https://docs.microsoft.com/en-us/learn/modules/integrate-vnets-with-vnet-peering/4-exercise-configure-vnet-peering-connections-using-azure-cli-commands

az network vnet peering create \
--name SalesVNet-To-MarketingVNet \
--remote-vnet MarketingVNet \
--resource-group learn-114ae29b-9f47-45ff-b4e7-58b1610d04b7 \
--vnet-name SalesVNet \
--allow-vnet-access

-> BadRequestError: Cannot parse the request.

Same error for me

az network vnet peering create \
--name MarketingVNet-To-ResearchVNet \
--remote-vnet ResearchVNet \
--resource-group learn-ab688f25-b6c0-4f3f-b517-18f11986d4e2 \
--vnet-name MarketingVNet \
--allow-vnet-access

image

Just arrived here from the same Microsoft Learn lesson, experiencing the same problem.

enterprise grade products mh? same here... I would recommend to introduce testing

Thanks for reporting and we're debugging it now

+1 and now it's getting really annoying as the hosted Agents in Azure DevOps have just been switched to 2.16 - So no one using Azure DevOps can create any network peerings using the Azure CLI task anylonger.

We are proactively following up with service team about this and will update later.

This broke our release processes that manage all our vnet peering. With the 2.16 release, several az commands have changed in ways that are broken our pipeline. As much as I love the tooling, I need stability.

any update on this one?

xpost from https://github.com/Azure/azure-cli/issues/16235#issuecomment-746773514

the following commands can be use to downgrade the version and unblock your builds on the hosted agents:

Windows:

choco uninstall azure-cli
choco install azure-cli --version 2.15.1
az version

Ubuntu:

sudo apt-get remove azure-cli
sudo apt-get install azure-cli=2.15.1-1~focal
az version

Please keep us posted on any issues with them. Thanks!

Thanks for comment. We have found the problem and it will be fixed in new version(will be released at about 2020/12/29). The problem could be avoided temporarily through downgrading version to 2.15.1.

image

image

image

image

image

@chtelf,

  • Did you log in as the root user?
  • What Linux distros did you use? Debian, Ubuntu?
  • From the error "sudo: command not found", it's not an issue related to Azure CLI. You can google it to resolve the issue.

Hi all,

I received a E: Version '2.15.1-1~focal' for 'azure-cli' was not found when trying to run sudo apt-get install azure-cli=2.15.1-1~focal in a pipeline task. This is a Bash@3 task running on a ubuntu-latest vmImage.

Full output from the task is below. Am I doing something wrong or using the wrong task?

- task: Bash@3
  inputs:
    displayName: "Downgrade AzCLI"
    targetType: 'inline'
    script: |
      sudo apt-get remove azure-cli
      sudo apt-get install azure-cli=2.15.1-1~focal
      az version

Cheers, Matt.

2020-12-18T02:08:44.4574026Z ##[section]Starting: Bash
2020-12-18T02:08:44.4584101Z ==============================================================================
2020-12-18T02:08:44.4584515Z Task         : Bash
2020-12-18T02:08:44.4584829Z Description  : Run a Bash script on macOS, Linux, or Windows
2020-12-18T02:08:44.4585267Z Version      : 3.179.0
2020-12-18T02:08:44.4585591Z Author       : Microsoft Corporation
2020-12-18T02:08:44.4585977Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
2020-12-18T02:08:44.4586461Z ==============================================================================
2020-12-18T02:08:44.8962925Z Generating script.
2020-12-18T02:08:44.8992275Z ========================== Starting Command Output ===========================
2020-12-18T02:08:44.9013407Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/a0b28c19-fa6f-4fb6-901b-6e7dc7fae9b1.sh
2020-12-18T02:08:51.1023973Z Reading package lists...
2020-12-18T02:08:51.3622586Z Building dependency tree...
2020-12-18T02:08:51.3709631Z Reading state information...
2020-12-18T02:08:51.6060604Z The following packages will be REMOVED:
2020-12-18T02:08:51.6071741Z   azure-cli
2020-12-18T02:08:52.3492323Z 0 upgraded, 0 newly installed, 1 to remove and 14 not upgraded.
2020-12-18T02:08:52.3497701Z After this operation, 615 MB disk space will be freed.
2020-12-18T02:08:52.3925440Z (Reading database ... 
2020-12-18T02:08:52.3926598Z (Reading database ... 5%
2020-12-18T02:08:52.3926876Z (Reading database ... 10%
2020-12-18T02:08:52.3927113Z (Reading database ... 15%
2020-12-18T02:08:52.3927360Z (Reading database ... 20%
2020-12-18T02:08:52.3927592Z (Reading database ... 25%
2020-12-18T02:08:52.3927839Z (Reading database ... 30%
2020-12-18T02:08:52.3928069Z (Reading database ... 35%
2020-12-18T02:08:52.3928310Z (Reading database ... 40%
2020-12-18T02:08:52.3928540Z (Reading database ... 45%
2020-12-18T02:08:52.4192247Z (Reading database ... 50%
2020-12-18T02:08:53.2728308Z (Reading database ... 55%
2020-12-18T02:08:54.1761998Z (Reading database ... 60%
2020-12-18T02:08:54.9609446Z (Reading database ... 65%
2020-12-18T02:08:55.9934555Z (Reading database ... 70%
2020-12-18T02:08:56.7716328Z (Reading database ... 75%
2020-12-18T02:08:57.4650512Z (Reading database ... 80%
2020-12-18T02:08:58.4540958Z (Reading database ... 85%
2020-12-18T02:08:59.3340779Z (Reading database ... 90%
2020-12-18T02:09:00.4700553Z (Reading database ... 95%
2020-12-18T02:09:00.4702491Z (Reading database ... 100%
2020-12-18T02:09:00.4704917Z (Reading database ... 278801 files and directories currently installed.)
2020-12-18T02:09:00.4878836Z Removing azure-cli (2.16.0-1~bionic) ...
2020-12-18T02:09:12.3137074Z Reading package lists...
2020-12-18T02:09:12.5184361Z Building dependency tree...
2020-12-18T02:09:12.5185025Z Reading state information...
2020-12-18T02:09:12.6291974Z E: Version '2.15.1-1~focal' for 'azure-cli' was not found
2020-12-18T02:09:12.6306505Z /home/vsts/work/_temp/a0b28c19-fa6f-4fb6-901b-6e7dc7fae9b1.sh: line 3: az: command not found
2020-12-18T02:09:12.6374312Z ##[error]Bash exited with code '127'.
2020-12-18T02:09:12.6466694Z ##[section]Finishing: Bash

How about install azure-cli through pip : "pip install azure.cli==2.15.1"

Hi @msyyc, thanks for the reply.

Doesn't look like anything above version 2.2.0 is found with pip:

Collecting azure.cli==2.15.1
  Could not find a version that satisfies the requirement azure.cli==2.15.1 (from versions: 0.1.0b9, 0.1.0b10, 0.1.0b11, 0.1.1b1, 0.1.1b2, 0.1.1b3, 0.1.2rc1, 0.1.2rc2, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.0.5, 2.0.6, 2.0.7, 2.0.8, 2.0.9, 2.0.10, 2.0.12, 2.0.13, 2.0.14, 2.0.15, 2.0.16, 2.0.17, 2.0.18, 2.0.19, 2.0.20, 2.0.21, 2.0.22, 2.0.23, 2.0.24, 2.0.25, 2.0.26, 2.0.27, 2.0.28, 2.0.29, 2.0.30, 2.0.31, 2.0.32, 2.0.33, 2.0.34, 2.0.35, 2.0.37, 2.0.38, 2.0.40, 2.0.41, 2.0.42, 2.0.43, 2.0.44, 2.0.45, 2.0.46, 2.0.47, 2.0.48, 2.0.49, 2.0.50, 2.0.51, 2.0.52, 2.0.53, 2.0.54, 2.0.55, 2.0.56, 2.0.57, 2.0.58, 2.0.59, 2.0.60, 2.0.61, 2.0.62, 2.0.63, 2.0.64, 2.0.65, 2.0.66, 2.0.67, 2.0.68, 2.0.69, 2.0.70, 2.0.71, 2.0.72, 2.0.73, 2.0.74, 2.0.75, 2.0.76, 2.0.77, 2.0.78, 2.0.79, 2.0.80, 2.0.81, 2.1.0, 2.2.0)
No matching distribution found for azure.cli==2.15.1

Edit: Actually, I'm not sure why, but on a re-run it was finding the correct version, but it is now failing at a different stage. I've put the output of sudo pip install azure-cli==2.15.1 below. I found some other threads that pointed to needing to update the tools first, but running sudo pip install --upgrade setuptools prior (which upgraded the tools from 39.0.1 to 44.1.1) didn't seem to help either.

2020-12-18T10:09:33.5227744Z ##[section]Starting: Bash
2020-12-18T10:09:33.5237081Z ==============================================================================
2020-12-18T10:09:33.5237454Z Task         : Bash
2020-12-18T10:09:33.5237748Z Description  : Run a Bash script on macOS, Linux, or Windows
2020-12-18T10:09:33.5238078Z Version      : 3.179.0
2020-12-18T10:09:33.5238333Z Author       : Microsoft Corporation
2020-12-18T10:09:33.5238718Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/bash
2020-12-18T10:09:33.5239154Z ==============================================================================
2020-12-18T10:09:33.6765614Z Generating script.
2020-12-18T10:09:33.6783881Z Script contents:
2020-12-18T10:09:33.6785749Z sudo pip install azure-cli==2.15.1
2020-12-18T10:09:33.6803021Z ========================== Starting Command Output ===========================
2020-12-18T10:09:33.6831343Z [command]/bin/bash --noprofile --norc /home/vsts/work/_temp/8cbefad7-0693-44d7-ab65-bb4e716c2521.sh
2020-12-18T10:09:34.3943468Z The directory '/home/vsts/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
2020-12-18T10:09:34.3944955Z The directory '/home/vsts/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
2020-12-18T10:09:34.4102094Z Collecting azure-cli==2.15.1
2020-12-18T10:09:34.5566620Z   Downloading https://files.pythonhosted.org/packages/6a/26/83f2aa19a5efa15fabd584e204ecb2d6c8eef516338e87936aecd7102958/azure-cli-2.15.1.tar.gz (1.6MB)
2020-12-18T10:09:35.3760415Z     Complete output from command python setup.py egg_info:
2020-12-18T10:09:35.3760895Z     running egg_info
2020-12-18T10:09:35.3761788Z     creating pip-egg-info/azure_cli.egg-info
2020-12-18T10:09:35.3762345Z     writing requirements to pip-egg-info/azure_cli.egg-info/requires.txt
2020-12-18T10:09:35.3762936Z     writing pip-egg-info/azure_cli.egg-info/PKG-INFO
2020-12-18T10:09:35.3763510Z     writing top-level names to pip-egg-info/azure_cli.egg-info/top_level.txt
2020-12-18T10:09:35.3764132Z     writing dependency_links to pip-egg-info/azure_cli.egg-info/dependency_links.txt
2020-12-18T10:09:35.3765900Z     writing manifest file 'pip-egg-info/azure_cli.egg-info/SOURCES.txt'
2020-12-18T10:09:35.3766275Z     Traceback (most recent call last):
2020-12-18T10:09:35.3766577Z       File "<string>", line 1, in <module>
2020-12-18T10:09:35.3767125Z       File "/tmp/pip-build-78iHKh/azure-cli/setup.py", line 199, in <module>
2020-12-18T10:09:35.3767452Z         cmdclass=cmdclass
2020-12-18T10:09:35.3768011Z       File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 162, in setup
2020-12-18T10:09:35.3771627Z         return distutils.core.setup(**attrs)
2020-12-18T10:09:35.3771980Z       File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
2020-12-18T10:09:35.3772303Z         dist.run_commands()
2020-12-18T10:09:35.3772604Z       File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
2020-12-18T10:09:35.3772927Z         self.run_command(cmd)
2020-12-18T10:09:35.3774535Z       File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
2020-12-18T10:09:35.3774867Z         cmd_obj.run()
2020-12-18T10:09:35.3775597Z       File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 296, in run
2020-12-18T10:09:35.3775960Z         self.find_sources()
2020-12-18T10:09:35.3776590Z       File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 303, in find_sources
2020-12-18T10:09:35.3776948Z         mm.run()
2020-12-18T10:09:35.3777861Z       File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 534, in run
2020-12-18T10:09:35.3778218Z         self.add_defaults()
2020-12-18T10:09:35.3778826Z       File "/usr/local/lib/python2.7/dist-packages/setuptools/command/egg_info.py", line 570, in add_defaults
2020-12-18T10:09:35.3779404Z         sdist.add_defaults(self)
2020-12-18T10:09:35.3780052Z       File "/usr/local/lib/python2.7/dist-packages/setuptools/command/py36compat.py", line 34, in add_defaults
2020-12-18T10:09:35.3780453Z         self._add_defaults_python()
2020-12-18T10:09:35.3781079Z       File "/usr/local/lib/python2.7/dist-packages/setuptools/command/sdist.py", line 135, in _add_defaults_python
2020-12-18T10:09:35.3781705Z         build_py = self.get_finalized_command('build_py')
2020-12-18T10:09:35.3782084Z       File "/usr/lib/python2.7/distutils/cmd.py", line 311, in get_finalized_command
2020-12-18T10:09:35.3782486Z         cmd_obj = self.distribution.get_command_obj(command, create)
2020-12-18T10:09:35.3782869Z       File "/usr/lib/python2.7/distutils/dist.py", line 846, in get_command_obj
2020-12-18T10:09:35.3783241Z         cmd_obj = self.command_obj[command] = klass(self)
2020-12-18T10:09:35.3783862Z       File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 180, in __init__
2020-12-18T10:09:35.3784250Z         _Command.__init__(self, dist)
2020-12-18T10:09:35.3784577Z       File "/usr/lib/python2.7/distutils/cmd.py", line 64, in __init__
2020-12-18T10:09:35.3784877Z         self.initialize_options()
2020-12-18T10:09:35.3785194Z       File "azure_cli_bdist_wheel.py", line 13, in initialize_options
2020-12-18T10:09:35.3785541Z         super(azure_cli_build_py, self).initialize_options()
2020-12-18T10:09:35.3785896Z     TypeError: super() argument 1 must be type, not classobj
2020-12-18T10:09:35.3786141Z     
2020-12-18T10:09:35.3786559Z     ----------------------------------------
2020-12-18T10:09:35.4010965Z Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-78iHKh/azure-cli/
2020-12-18T10:09:35.4373732Z ##[error]Bash exited with code '1'.
2020-12-18T10:09:35.4389933Z ##[section]Finishing: Bash
  1. "python --version": confirm python version(CLI don't support python 2.x anymore)
  2. "python -m venv myvenv":create virtual python environment
  3. "source myvenv/bin/activate":enter the virtual env
  4. "pip install azure-cli==2.15.1"
  5. "az version" : confirm whether downgrade succeeds.

An edge build with fix is ready for you, you can use this build before our official release on 12/29.

The fix has been released, please upgrade to latest Azure CLI version to verify if this issue is resolved.
So close this issue, if this issue still exists, please reopen this issue and let us know.

Was this page helpful?
0 / 5 - 0 ratings