Giter Site home page Giter Site logo

Comments (9)

v-starodubov avatar v-starodubov commented on August 19, 2024 9

az config set core.login_experience_v2=off
Could help to resolve errors, until it's fixed.

from azure-cli.

azure-client-tools-bot-prd avatar azure-client-tools-bot-prd commented on August 19, 2024 1

Hi @ronttizz
Find similar issue #16946.

Issue title A stacktrace with a disorienting message is shown for az apim api import
Create time 2021-02-16
Comment number 3

Possible solution:
The error message "can only concatenate str (not "NoneType") to str" is shown in both issues. In the existing issue, the error message is caused by not specifying the --specification-format parameter. Similarly, in the new issue, the error message is caused by a similar issue. The solution to the new issue is to specify the --specification-format parameter. You can check all the valid values for the --specification-format parameter by running "az apim api import -h".


Please confirm if this resolves your issue.

from azure-cli.

XhmikosR avatar XhmikosR commented on August 19, 2024 1

Confirmed that @v-starodubov's suggestion allows me to successfully login. Would be nice if this was fixed ASAP though since it's a serious regression.

from azure-cli.

TheOnlyWei avatar TheOnlyWei commented on August 19, 2024 1

Same issue for our on-premises or hybrid environment. After the work-around for this different issue (#28997):

az account clear
az config set core.enable_broker_on_windows=false

I get the error in this GitHub issue above. However, I still end up being logged into the account. It just throws the error.

from azure-cli.

yonzhan avatar yonzhan commented on August 19, 2024

Thank you for opening this issue, we will look into it.

from azure-cli.

jiasli avatar jiasli commented on August 19, 2024
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 52, in _format_subscription_table
    'Tenant': highlight_text(self._get_tenant_string(sub), is_default)

indicates self._get_tenant_string(sub) returned None:

@staticmethod
def _get_tenant_string(subscription):
try:
return subscription[_TENANT_DISPLAY_NAME]
except KeyError:
return subscription[_TENANT_ID]

According to the log provided by @m1iktea in #29241 (comment), https://management.azure.com/tenants?api-version=2022-12-01 API returned

cli.azure.cli.core.sdk.policies: {"value":[{"id":"/tenants/122f6959-7492-42d8-8cf5-f9233ac18c4f","tenantId":"122f6959-7492-42d8-8cf5-f9233ac18c4f","tenantCategory":"Home"}]}

displayName property is missing from the response JSON. This contradicts the ARM public document https://learn.microsoft.com/en-us/rest/api/resources/tenants/list?view=rest-resources-2022-12-01

@ronttizz, @v-starodubov, @XhmikosR, @TheOnlyWei, could you also check the --debug log and share the HTTP trace of https://management.azure.com/tenants?api-version=2022-12-01 API call?

from azure-cli.

v-starodubov avatar v-starodubov commented on August 19, 2024

@jiasli sure

cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/tenants?api-version=2022-12-01'
...
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"value":[{"id":"/tenants/d2012c1c-e56f-4ea4-ac1a-9d94f1c563c6","tenantId":"d2012c1c-e56f-4ea4-ac1a-9d94f1c563c6","tenantCategory":"Home"}]}

And error has dropped after the subscription request, may be related also 🤔

cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions?api-version=2022-12-01'
...
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"value":[{"id":"/subscriptions/c8ed0cd4-dc57-41a9-ab2c-54beec7b9510","authorizationSource":"RoleBased","managedByTenants":[],"subscriptionId":"c8ed0cd4-dc57-41a9-ab2c-54beec7b9510","tenantId":"d2012c1c-e56f-4ea4-ac1a-9d94f1c563c6","displayName":"Microsoft Azure Sponsorship","state":"Enabled","subscriptionPolicies":{"locationPlacementId":"Public_2014-09-01","quotaId":"Sponsored_2016-01-01","spendingLimit":"Off"}}],"count":{"type":"Total","value":1}}

cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 731, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 701, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 334, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/profile/custom.py", line 175, in login
    selected = SubscriptionSelector(subscriptions)()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 19, in __init__
    self._format_subscription_table()
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 52, in _format_subscription_table
    'Tenant': highlight_text(self._get_tenant_string(sub), is_default)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 31, in highlight_text
    return format_styled_text((Style.HIGHLIGHT, text)) if row_is_default else text
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/style.py", line 201, in format_styled_text
    formatted_parts.append(escape_seq + raw_text)
                           ~~~~~~~~~~~^~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str

from azure-cli.

ronttizz avatar ronttizz commented on August 19, 2024
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions?api-version=2022-12-01'
...
cli.azure.cli.core.sdk.policies: Response content:
// Not sure if I can post the contents of the array so I deleted it for safety
cli.azure.cli.core.sdk.policies: {"value":[]}
cli.azure.cli.core.azclierror: Traceback (most recent call last):
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/knack/cli.py", line 233, in invoke
    cmd_result = self.invocation.execute(args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 664, in execute
    raise ex
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 731, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 701, in _run_job
    result = cmd_copy(params)
             ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/__init__.py", line 334, in __call__
    return self.handler(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
           ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/profile/custom.py", line 175, in login
    selected = SubscriptionSelector(subscriptions)()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 19, in __init__
    self._format_subscription_table()
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 52, in _format_subscription_table
    'Tenant': highlight_text(self._get_tenant_string(sub), is_default)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/command_modules/profile/_subscription_selector.py", line 31, in highlight_text
    return format_styled_text((Style.HIGHLIGHT, text)) if row_is_default else text
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/azure-cli/2.61.0/libexec/lib/python3.11/site-packages/azure/cli/core/style.py", line 201, in format_styled_text
    formatted_parts.append(escape_seq + raw_text)
                           ~~~~~~~~~~~^~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str

from azure-cli.

ronttizz avatar ronttizz commented on August 19, 2024

It seems that this error is not blocking me from the login itself like @TheOnlyWei pointed out.

from azure-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.