Skip to content

azext_applicationinsights unexpected error: TypeError: Profile.get_login_credentials() got an unexpected keyword argument 'resource' #31748

@DmitriySeredaKnowit

Description

@DmitriySeredaKnowit

Describe the bug

I found a similar issue #30947, but it seems that it wasn't fixed everywhere.

I have a PowerShell script that I'm running once in a quarter, and last quarter, everything worked fine.

I tried to run the script twice on different CLI versions, 2.70.0, and the latest

Related command

az monitor app-insights query --resource-group "$resourceGroupName" --app "$appName" --analytics-query $query

Errors

az : ERROR: The command failed with an unexpected error. Here is the traceback:
At line:1 char:1

  • az monitor app-insights query --resource-group "$resourceGroupName" - ...
  •   + CategoryInfo          : NotSpecified: (ERROR: The comm... the traceback::String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
    
    

ERROR: Profile.get_login_credentials() got an unexpected keyword argument 'resource'
Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 666, in execute
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 734, in _run_jobs_serial
ly
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 703, in run_job
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 336, in call
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 111, in handler
File "C:\Users{username}.azure\cliextensions\application-insights\azext_applicationinsights_client_factory.py", line 12, in applicationinsights

data_plane_client
cred, _, _ = profile.get_login_credentials(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Profile.get_login_credentials() got an unexpected keyword argument 'resource'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues

Issue script & Debug output

az monitor app-insights query --resource-group "$resourceGroupName" --app "$appName" --analytics-query $query --debug
az : DEBUG: cli.knack.cli: Command arguments: ['monitor', 'app-insights', 'query', '--resource-group', '{resourceGroupName}', '--app', '{appName}'
, '--analytics-query', "let testNames = availabilityResults | summarize by name; availabilityResults | where name in (testNames) | summarize ['S
uccess Percent'] = strcat(tostring(round((countif(success == 1) * 100.0 / count()), 2)), '%'), ['Average Fail Duration'] = strcat(tostring(round
(avg(duration))), ' ms') by ['Test Name'] = name | union (availabilityResults | summarize ['Success Percent'] = strcat(tostring(round((countif(s
uccess == 1) * 100.0 / count()), 2)), '%'), ['Average Fail Duration'] = strcat(tostring(round(avg(duration))), ' ms') | extend ['Test Name'] = '
Overall') | sort by ['Success Percent'] asc", '--debug']
At line:1 char:1

  • az monitor app-insights query --resource-group "$resourceGroupName" - ...
  •   + CategoryInfo          : NotSpecified: (DEBUG: cli.knac...sc", '--debug']:String) [], RemoteException
      + FullyQualifiedErrorId : NativeCommandError
    
    

DEBUG: cli.knack.cli: init debug log:
Cannot enable color.
DEBUG: cli.knack.cli: Event: Cli.PreExecute []
DEBUG: cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x00000256E6F5F2E0>, <function O
utputProducer.on_global_arguments at 0x00000256E72FC180>, <function CLIQuery.on_global_arguments at 0x00000256E7321580>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
DEBUG: cli.azure.cli.core: Modules found from index for 'monitor': ['azure.cli.command_modules.monitor', 'azext_applicationinsights']
DEBUG: cli.azure.cli.core: Loading command modules:
DEBUG: cli.azure.cli.core: Name Load Time Groups Commands
DEBUG: cli.azure.cli.core: monitor 0.688 22 68
DEBUG: cli.azure.cli.core: Total (1) 0.688 22 68
DEBUG: cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
DEBUG: cli.azure.cli.core: Loading extensions:
DEBUG: cli.azure.cli.core: Name Load Time Groups Commands Directory
DEBUG: cli.azure.cli.core: application-insights 0.094 12 36 C:\Users{username}.azure\cliextensions\application-insights
DEBUG: cli.azure.cli.core: Total (1) 0.094 12 36
DEBUG: cli.azure.cli.core: Loaded 33 groups, 104 commands.
DEBUG: cli.azure.cli.core: Found a match in the command table.
DEBUG: cli.azure.cli.core: Raw command : monitor app-insights query
DEBUG: cli.azure.cli.core: Command table: monitor app-insights query
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x00000256E955B1A0>]
DEBUG: cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users{username}.azure\commands\2025-07-01.16-45-21.monitor
_app-insights_query.79516.log'.
INFO: az_command_data_logger: command args: monitor app-insights query --resource-group {} --app {} --analytics-query {} --debug
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_paramet
er at 0x00000256E9692340>]
INFO: cli.knack.commands: Configured default '{appName}' for arg resource_group_name
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x00000256E9
6923E0>, <function register_cache_arguments..add_cache_arguments at 0x00000256E9692520>, <function register_upcoming_breaking_change_inf
o..update_breaking_change_info at 0x00000256E96925C0>]
DEBUG: cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
DEBUG: cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x00000256E72FC220>, <function C
LIQuery.handle_query_parameter at 0x00000256E7321620>, <function register_ids_argument..parse_ids_arguments at 0x00000256E9692480>]
INFO: az_command_data_logger: extension name: application-insights
INFO: az_command_data_logger: extension version: 1.2.0
DEBUG: cli.azure.cli.core.azclierror: Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 666, in execute
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 734, in _run_jobs_serial
ly
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 703, in run_job
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 336, in call
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 111, in handler
File "C:\Users{username}.azure\cliextensions\application-insights\azext_applicationinsights_client_factory.py", line 12, in applicationinsights

data_plane_client
cred, _, _ = profile.get_login_credentials(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Profile.get_login_credentials() got an unexpected keyword argument 'resource'
ERROR: cli.azure.cli.core.azclierror: The command failed with an unexpected error. Here is the traceback:
ERROR: az_command_data_logger: The command failed with an unexpected error. Here is the traceback:
ERROR: cli.azure.cli.core.azclierror: Profile.get_login_credentials() got an unexpected keyword argument 'resource'
Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 666, in execute
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 734, in _run_jobs_serial
ly
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 703, in run_job
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 336, in call
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 111, in handler
File "C:\Users{username}.azure\cliextensions\application-insights\azext_applicationinsights_client_factory.py", line 12, in applicationinsights

data_plane_client
cred, _, _ = profile.get_login_credentials(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Profile.get_login_credentials() got an unexpected keyword argument 'resource'
ERROR: az_command_data_logger: Profile.get_login_credentials() got an unexpected keyword argument 'resource'
Traceback (most recent call last):
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\knack/cli.py", line 233, in invoke
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 666, in execute
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 734, in _run_jobs_serial
ly
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 703, in run_job
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/init.py", line 336, in call
File "D:\a_work\1\s\build_scripts\windows\artifacts\cli\Lib\site-packages\azure/cli/core/commands/command_operation.py", line 111, in handler
File "C:\Users{username}.azure\cliextensions\application-insights\azext_applicationinsights_client_factory.py", line 12, in applicationinsights

data_plane_client
cred, , _ = profile.get_login_credentials(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Profile.get_login_credentials() got an unexpected keyword argument 'resource'
To check existing issues, please visit: https://github.com/Azure/azure-cli/issues
DEBUG: cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x00000256E955B420>]
INFO: az_command_data_logger: exit code: 1
INFO: cli.main: Command ran in 1.290 seconds (init: 0.344, invoke: 0.946)
INFO: telemetry.main: Begin splitting cli events and extra events, total events: 1
INFO: telemetry.client: Accumulated 0 events. Flush the clients.
INFO: telemetry.main: Finish splitting cli events and extra events, cli events: 1
INFO: telemetry.save: Save telemetry record of length 8161 in cache file under C:\Users{username}.azure\telemetry\20250701164522037
INFO: telemetry.main: Begin creating telemetry upload process.
INFO: telemetry.process: Creating upload process: "C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files\Microsoft SDKs\Azure\C
LI2\Lib\site-packages\azure\cli\telemetry_init
.pyc C:\Users{username}.azure C:\Users{username}.azure\telemetry\20250701164522037"
INFO: telemetry.process: Return from creating process 55384
INFO: telemetry.main: Finish creating telemetry upload process.

Expected behavior

Command executed without errors

Environment Summary

azure-cli 2.74.0 *

core 2.74.0 *
telemetry 1.1.0

Extensions:
application-insights 1.2.0

Dependencies:
msal 1.32.3
azure-mgmt-resource 23.3.0

Python location 'C:\Program Files\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users{username}.azure'
Extensions directory 'C:\Users{username}.azure\cliextensions'

Python (Windows) 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)]

Legal docs and information: aka.ms/AzureCliLegal

Additional context

No response

Metadata

Metadata

Assignees

Labels

Auto-AssignAuto assign by botAuto-ResolveAuto resolve by botAzure CLI TeamThe command of the issue is owned by Azure CLI teamMonitoraz monitorSimilar-Issuecustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions