az acr生成命令失败“ NotImplementedError:APIVersion 2019-06-01-预览不可用”

时间:2020-05-29 21:05:47

标签: azure-cli acr

我正在jupyter笔记本的AML工作区中运行以下命令:

!az acr build --image mlnet --subscription $ws.subscription_id --registry $cr --file docker/Dockerfile docker/

命令失败,出现以下错误:


APIVersion 2019-06-01-preview is not available
Traceback (most recent call last):
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/knack/cli.py", line 215, in invoke
    cmd_result = self.invocation.execute(args)
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 631, in execute
    raise ex
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 695, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 688, in _run_job
    six.reraise(*sys.exc_info())
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/six.py", line 703, in reraise
    raise value
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 665, in _run_job
    result = cmd_copy(params)
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 324, in __call__
    return self.handler(*args, **kwargs)
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 565, in default_command_handler
    client = client_factory(cmd.cli_ctx, command_args) if client_factory else None
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/cli/command_modules/acr/_client_factory.py", line 47, in cf_acr_runs
    return get_acr_service_client(cli_ctx, VERSION_2019_06_01_PREVIEW).runs
  File "/anaconda/envs/azureml_py36/lib/python3.6/site-packages/azure/mgmt/containerregistry/container_registry_management_client.py", line 246, in runs
    raise NotImplementedError("APIVersion {} is not available".format(api_version))
NotImplementedError: APIVersion 2019-06-01-preview is not available

To open an issue, please run: 'az feedback'

如何调试并克服此错误?

1 个答案:

答案 0 :(得分:0)

看起来像更新cli版本可以解决此问题。我遇到了同样的问题。使用以下命令升级了azure cli版本。升级后,acr命令运行正常。

pip install --upgrade azure-cli