-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Description
Describe the bug
Output for az:
az graph query -q "resourcecontainers | where type =~ 'microsoft.management/managementgroups'"
{
"count": 0,
"data": [],
"skip_token": null,
"total_records": 0
}
Output for Search-AzGraph:
Search-AzGraph -Query "resourcecontainers | where type =~ 'microsoft.management/managementgroups'" | ConvertTo-Json
Good output
Related command
az graph query -q "resourceContainers | where type =~ 'microsoft.management/managementgroups' "
Errors
Bad output:
{
"count": 0,
"data": [],
"skip_token": null,
"total_records": 0
}
Issue script & Debug output
az graph query -q "resourcecontainers | where type =~ 'microsoft.management/managementgroups'" --debug
cli.knack.cli: Command arguments: ['graph', 'query', '-q', "resourcecontainers | where type =~ 'microsoft.management/managementgroups'", '--debug']
cli.knack.cli: init debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7f88021af920>, <function OutputProducer.on_global_arguments at 0x7f8801efa840>, <function CLIQuery.on_global_arguments at 0x7f8801f3fd80>]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Modules found from index for 'graph': ['azext_resourcegraph']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: Total (0) 0.000 0 0
cli.azure.cli.core: These extensions are not installed and will be skipped: ['azext_ai_examples', 'azext_next']
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: resource-graph 0.004 2 5 /home/user/.azure/cliextensions/resource-graph
cli.azure.cli.core: Total (1) 0.004 2 5
cli.azure.cli.core: Loaded 2 groups, 5 commands.
cli.azure.cli.core: Found a match in the command table.
cli.azure.cli.core: Raw command : graph query
cli.azure.cli.core: Command table: graph query
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7f8801180220>]
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to '/home/user/.azure/commands/2025-06-22.18-56-14.graph_query.86909.log'.
az_command_data_logger: command args: graph query -q {} --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [<function register_global_subscription_argument..add_subscription_parameter at 0x7f88011cc720>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [<function register_ids_argument..add_ids_arguments at 0x7f88011cef20>, <function register_cache_arguments..add_cache_arguments at 0x7f88011cf060>, <function register_upcoming_breaking_change_info..update_breaking_change_info at 0x7f88011cf100>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7f8801efa8e0>, <function CLIQuery.handle_query_parameter at 0x7f8801f3fe20>, <function register_ids_argument..parse_ids_arguments at 0x7f88011cefc0>]
az_command_data_logger: extension name: resource-graph
az_command_data_logger: extension version: 2.1.1
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ResourceGraphClient
cli.azure.cli.core.auth.persistence: build_persistence: location='/home/user/.azure/msal_token_cache.json', encrypt=False
cli.azure.cli.core.auth.binary_cache: load: /home/user/.azure/msal_http_cache.bin
urllib3.util.retry: Converted retries value: 1 -> Retry(total=1, connect=None, read=None, redirect=None, status=None)
msal.authority: Initializing with Entra authority: https://login.microsoftonline.com/0000000-0000-0000-0000-000000000000
msal.authority: openid_config("https://login.microsoftonline.com/0000000-0000-0000-0000-000000000000/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/0000000-0000-0000-0000-000000000000/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/0000000-0000-0000-0000-000000000000/discovery/v2.0/keys', 'response_modes_supported': ['query', 'fragment', 'form_post'], 'subject_types_supported': ['pairwise'], 'id_token_signing_alg_values_supported': ['RS256'], 'response_types_supported': ['code', 'id_token', 'code id_token', 'id_token token'], 'scopes_supported': ['openid', 'profile', 'email', 'offline_access'], 'issuer': 'https://login.microsoftonline.com/0000000-0000-0000-0000-000000000000/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/0000000-0000-0000-0000-000000000000/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/0000000-0000-0000-0000-000000000000/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/0000000-0000-0000-0000-000000000000/oauth2/v2.0/logout', 'claims_supported': ['sub', 'iss', 'cloud_instance_name', 'cloud_instance_host_name', 'cloud_graph_host_name', 'msgraph_host', 'aud', 'exp', 'iat', 'auth_time', 'acr', 'nonce', 'preferred_username', 'name', 'tid', 'ver', 'at_hash', 'c_hash', 'email'], 'kerberos_endpoint': 'https://login.microsoftonline.com/0000000-0000-0000-0000-000000000000/kerberos', 'tenant_region_scope': 'EU', 'cloud_instance_name': 'microsoftonline.com', 'cloud_graph_host_name': 'graph.windows.net', 'msgraph_host': 'graph.microsoft.com', 'rbac_url': 'https://pas.windows.net'}
msal.application: Broker enabled? None
cli.azure.cli.core: Current cloud config:
AzureCloud
cli.azure.cli.core.auth.credential_adaptor: CredentialAdaptor.get_token_info: scopes=('https://management.core.windows.net//.default',), options={}
cli.azure.cli.core.auth.msal_credentials: UserCredential.acquire_token: scopes=['https://management.core.windows.net//.default'], claims_challenge=None, kwargs={}
msal.application: Cache hit an AT
msal.telemetry: Generate or reuse correlation_id: b25f2759-6f20-463a-8848-cb34a0446f5b
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01'
cli.azure.cli.core.sdk.policies: Request method: 'POST'
cli.azure.cli.core.sdk.policies: Request headers:
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json'
cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
cli.azure.cli.core.sdk.policies: 'Content-Length': '324'
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': 'ceef87b2-4f89-11f0-8f99-cff8efcddde0'
cli.azure.cli.core.sdk.policies: 'CommandName': 'graph query'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-q --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.74.0 (DEB) azsdk-python-core/1.31.0 Python/3.12.10 (Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.35)'
cli.azure.cli.core.sdk.policies: 'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: {"subscriptions": ["0000000-0000-0000-0000-000000000000", "0000000-0000-0000-0000-000000000000", "0000000-0000-0000-0000-000000000000"], "query": "resourcecontainers | where type =~ 'microsoft.management/managementgroups'", "options": {"$top": 100, "$skip": 0, "resultFormat": "objectArray", "allowPartialScopes": false}}
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "POST /providers/Microsoft.ResourceGraph/resources?api-version=2021-03-01 HTTP/1.1" 200 76
cli.azure.cli.core.sdk.policies: Response status: 200
cli.azure.cli.core.sdk.policies: Response headers:
cli.azure.cli.core.sdk.policies: 'Cache-Control': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Pragma': 'no-cache'
cli.azure.cli.core.sdk.policies: 'Content-Length': '76'
cli.azure.cli.core.sdk.policies: 'Content-Type': 'application/json; charset=utf-8'
cli.azure.cli.core.sdk.policies: 'Expires': '-1'
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': 'f5eb00b6-d06d-4013-8a37-e2476262e26f'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-tenant-resource-requests': '14'
cli.azure.cli.core.sdk.policies: 'x-ms-user-quota-remaining': '14'
cli.azure.cli.core.sdk.policies: 'x-ms-user-quota-resets-after': '00:00:05'
cli.azure.cli.core.sdk.policies: 'x-ms-resource-graph-request-duration': '0:00:00:00.1946272'
cli.azure.cli.core.sdk.policies: 'x-ms-operation-identifier': ''
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-tenant-reads': '249'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': 'f5eb00b6-d06d-4013-8a37-e2476262e26f'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'SPAINCENTRAL:20250622T165615Z:f5eb00b6-d06d-4013-8a37-e2476262e26f'
cli.azure.cli.core.sdk.policies: 'X-Content-Type-Options': 'nosniff'
cli.azure.cli.core.sdk.policies: 'X-Cache': 'CONFIG_NOCACHE'
cli.azure.cli.core.sdk.policies: 'X-MSEdge-Ref': 'Ref A: 05EFE286A07F4175B0E256002E67797C Ref B: MAD201130412029 Ref C: 2025-06-22T16:56:15Z'
cli.azure.cli.core.sdk.policies: 'Date': 'Sun, 22 Jun 2025 16:56:15 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: {"totalRecords":0,"count":0,"data":[],"facets":[],"resultTruncated":"false"}
cli.knack.cli: Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x7f88011cc4a0>, <function _x509_from_base64_to_hex_transform at 0x7f88011cc540>]
cli.knack.cli: Event: CommandInvoker.OnFilterResult []
{
"count": 0,
"data": [],
"skip_token": null,
"total_records": 0
}
cli.knack.cli: Event: Cli.SuccessfulExecute []
cli.knack.cli: Event: Cli.PostExecute [<function AzCliLogging.deinit_cmd_metadata_logging at 0x7f88011804a0>]
az_command_data_logger: exit code: 0
cli.main: Command ran in 1.109 seconds (init: 0.233, invoke: 0.876)
telemetry.main: Begin splitting cli events and extra events, total events: 1
telemetry.client: Accumulated 0 events. Flush the clients.
telemetry.main: Finish splitting cli events and extra events, cli events: 1
telemetry.save: Save telemetry record of length 4011 in cache file under /home/user/.azure/telemetry/20250622185615947
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "/opt/az/bin/python3 /opt/az/lib/python3.12/site-packages/azure/cli/telemetry/init.py /home/user/.azure /home/user/.azure/telemetry/20250622185615947"
telemetry.process: Return from creating process 86926
telemetry.main: Finish creating telemetry upload process.
Expected behavior
Same or similar ouput in az graph query -q and Search-AzGraph for the same query.
Environment Summary
az --version
azure-cli 2.74.0
core 2.74.0
telemetry 1.1.0
Extensions:
resource-graph 2.1.1
Dependencies:
msal 1.32.3
mgmt. 23.3.0
Python location '/opt/az/bin/python3'
Config directory '/home/user/.azure'
Extensions directory '/home/user/.azure/cliextensions'
Python (Linux) 3.12.10 (main, May 27 2025, 09:12:38) [GCC 11.4.0]
Legal docs and information: aka.ms/AzureCliLegal
Your CLI is up-to-date.
Additional context
No response