Azure-cli: 'az webapp log tail': 'str' object has no attribute 'cloud'

Created on 17 Jan 2018  路  11Comments  路  Source: Azure/azure-cli

Environment summary

Install Method (apt-get) / CLI version (azure-cli (2.0.25)) / OS version (Linux Mint 18) / Shell Type (bash)

Every time I run az webapp log tail --resource-group TypesPublisher --name TypesPublisher:

'str' object has no attribute 'cloud'
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 194, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 319, in execute
    six.reraise(*sys.exc_info())
  File "/opt/az/lib/python3.6/site-packages/six.py", line 693, in reraise
    raise value
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 292, in execute
    result = cmd(params)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 169, in __call__
    return super(AzCliCommand, self).__call__(*args, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/knack/commands.py", line 109, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 337, in default_command_handler
    result = op(**command_args)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/appservice/custom.py", line 1222, in get_streaming_log
    user, password = _get_site_credential(resource_group_name, name, slot)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/appservice/custom.py", line 1240, in _get_site_credential
    creds = _generic_site_operation(resource_group_name, name, 'list_publishing_credentials', slot)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/appservice/_appservice_utils.py", line 11, in _generic_site_operation
    client = client or web_client_factory(cli_ctx)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/command_modules/appservice/_client_factory.py", line 35, in web_client_factory
    return get_mgmt_service_client(cli_ctx, WebSiteManagementClient)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/client_factory.py", line 35, in get_mgmt_service_client
    api_version=api_version, sdk_profile=sdk_profile, **kwargs)
  File "/opt/az/lib/python3.6/site-packages/azure/cli/core/commands/client_factory.py", line 83, in _get_mgmt_service_client
    resource = resource or cli_ctx.cloud.endpoints.active_directory_resource_id
AttributeError: 'str' object has no attribute 'cloud'

This command used to work, but I may have updated az since then.

P1 Web Apps

All 11 comments

Due to knack conversion, cli_ctx is needed to create any clients and we missed that.
Because related tests can only run live, I suggest:

  1. For any PR merged, please manually verify every impacted scenarios per code change
  2. I will ensure check out live test results before release

I will take this one due to the severity and we need to fix asap

Thanks @yugangw-msft

Can this not be unit tested in lieu of Live Test? That would catch the missing cli_ctx error.

I have added a few unit tests. That said, live tests still need to run to ensure commands really function well. For context, those are binary payload based commands and so far our test framework is not able to record them for playback.

I'm still encountering this error on the latest version of azure cli, and can't figure out how I'm supposed to view the logs for my live web app?

The fix will be released next week. For now you can use docker images or edge builds mentioned at https://github.com/Azure/azure-cli#docker

+1

Hi, any update on this?
Thanks

@pmosconi, please install the latest CLI which has the fix

@yugangw-msft , thanks for the prompt reply: I'm on 2.0.25, the latest prod version and I can't install a dev release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ahmetb picture ahmetb  路  3Comments

rlewkowicz picture rlewkowicz  路  3Comments

derekbekoe picture derekbekoe  路  3Comments

dhermans picture dhermans  路  3Comments

seanknox picture seanknox  路  3Comments