Azure / Azure/azure-sdk-for-python

Response bodies missing when using `--verbose --debug`

Open
#41,825 3 comments 0 reactions 2 assignees Claimed by @msyyc View on GitHub
ARM bug Mgmt question Service Attention
Dominant language
Python
Stars
5.6k
Forks
3.4k
Avg merge
1d 21h
Merged PRs (30d)
193

Description

### Describe the bug

We often use `--verbose --debug` flags to troubleshoot RP problems and give to customers to self-service troubleshoot. With more recent versions of Azure CLI, some command groups just log `Body is streamable` instead of actually logging the response body.

![Image](https://github.com/user-attachments/assets/a6f7979a-c1a5-4ea1-a6a8-d81e25ae1f82)

### Related command

`az group export`

### Errors

"Body is streamable"

### Issue script & Debug output

```
PS C:\Users\antmarti> az group export -n ang-rg1 --verbose --debug
cli.knack.cli: Command arguments: ['group', 'export', '-n', 'ang-rg1', '--verbose', '--debug']
cli.knack.cli: __init__ debug log:
Enable color in terminal.
cli.knack.cli: Event: Cli.PreExecute []
cli.knack.cli: Event: CommandParser.OnGlobalArgumentsCreate [, , ]
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableCreate []
cli.azure.cli.core: Command index version or cloud profile is invalid or doesn't match the current command.
cli.azure.cli.core: Command index has been invalidated.
cli.azure.cli.core: No module found from index for '['group', 'export', '-n', 'ang-rg1', '--verbose', '--debug']'
cli.azure.cli.core: Loading all modules and extensions
cli.azure.cli.core: Discovered command modules: ['acr', 'acs', 'advisor', 'ams', 'apim', 'appconfig', 'appservice', 'aro', 'backup', 'batch', 'batchai', 'billing', 'botservice', 'cdn', 'cloud', 'cognitiveservices', 'compute_recommender', 'computefleet', 'config', 'configure', 'consumption', 'container', 'containerapp', 'cosmosdb', 'databoxedge', 'dls', 'dms', 'eventgrid', 'eventhubs', 'extension', 'feedback', 'find', 'hdinsight', 'identity', 'interactive', 'iot', 'keyvault', 'lab', 'managedservices', 'maps', 'marketplaceordering', 'monitor', 'mysql', 'netappfiles', 'network', 'policyinsights', 'privatedns', 'profile', 'rdbms', 'redis', 'relay', 'resource', 'role', 'search', 'security', 'servicebus', 'serviceconnector', 'servicefabric', 'signalr', 'sql', 'sqlvm', 'storage', 'synapse', 'util', 'vm']
cli.azure.cli.core: Loading command modules:
cli.azure.cli.core: Name Load Time Groups Commands
cli.azure.cli.core: acr 0.715 36 149
cli.azure.cli.core: acs 0.043 15 79
cli.azure.cli.core: advisor 0.003 3 6
cli.azure.cli.core: ams 0.008 22 100
cli.azure.cli.core: apim 0.013 14 69
cli.azure.cli.core: appconfig 0.006 9 47
cli.azure.cli.core: appservice 0.048 80 277
cli.azure.cli.core: aro 0.024 1 10
cli.azure.cli.core: backup 0.007 16 60
cli.azure.cli.core: batch 0.071 32 96
cli.azure.cli.core: batchai 0.006 10 30
cli.azure.cli.core: billing 0.033 19 53
cli.azure.cli.core: botservice 0.007 12 42
cli.azure.cli.core: cdn 0.283 8 50
cli.azure.cli.core: cloud 0.004 1 7
cli.azure.cli.core: cognitiveservices 0.005 10 33
cli.azure.cli.core: compute_recommender 0.009 1 1
cli.azure.cli.core: computefleet 0.015 1 1
cli.azure.cli.core: config 0.004 2 7
cli.azure.cli.core: configure 0.003 2 5
cli.azure.cli.core: consumption 0.038 8 9
cli.azure.cli.core: container 0.020 2 17
cli.azure.cli.core: containerapp 0.216 37 123
cli.azure.cli.core: cosmosdb 0.029 58 200
cli.azure.cli.core: databoxedge 0.018 5 28
cli.azure.cli.core: dls 0.005 6 36
cli.azure.cli.core: dms 0.004 3 22
cli.azure.cli.core: eventgrid 0.007 25 96
cli.azure.cli.core: eventhubs 0.028 14 21
cli.azure.cli.core: extension 0.002 1 7
cli.azure.cli.core: feedback 0.002 1 2
cli.azure.cli.core: find 0.003 1 1
cli.azure.cli.core: hdinsight 0.015 9 42
cli.azure.cli.core: identity 0.017 2 7
cli.azure.cli.core: interactive 0.001 1 1
cli.azure.cli.core: iot 0.144 19 82
cli.azure.cli.core: keyvault 0.011 20 114
cli.azure.cli.core: lab 0.083 9 30
cli.azure.cli.core: managedservices 0.023 3 8
cli.azure.cli.core: maps 0.005 5 13
cli.azure.cli.core: marketplaceordering 0.008 1 2
cli.azure.cli.core: monitor 0.451 18 64
cli.azure.cli.core: mysql 0.156 16 56
cli.azure.cli.core: netappfiles 0.098 8 15
cli.azure.cli.core: network 0.099 105 350
cli.azure.cli.core: policyinsights 0.027 9 17
cli.azure.cli.core: privatedns 0.045 14 60
cli.azure.cli.core: profile 0.004 2 8
cli.azure.cli.core: rdbms 0.133 52 217
cli.azure.cli.core: redis 0.006 7 38
cli.azure.cli.core: relay 0.051 7 8
cli.azure.cli.core: resource 0.024 52 232
cli.azure.cli.core: role 0.004 17 62
cli.azure.cli.core: search 0.018 7 19
cli.azure.cli.core: security 0.020 48 98
cli.azure.cli.core: servicebus 0.019 13 17
cli.azure.cli.core: serviceconnector 0.062 20 331
cli.azure.cli.core: servicefabric 0.028 27 80
cli.azure.cli.core: signalr 0.006 10 42
cli.azure.cli.core: sql 0.024 56 215
cli.azure.cli.core: sqlvm 0.037 4 20
cli.azure.cli.core: storage 0.100 60 275
cli.azure.cli.core: synapse 0.016 54 246
cli.azure.cli.core: util 0.003 3 7
cli.azure.cli.core: vm 0.104 59 262
cli.azure.cli.core: Total (65) 3.521 1192 4722
cli.azure.cli.core: Loading extensions:
cli.azure.cli.core: Name Load Time Groups Commands Directory
cli.azure.cli.core: azure-devops 0.036 60 192 C:\Users\antmarti\.azure\cliextensions\azure-devops
cli.azure.cli.core: Total (1) 0.036 60 192
cli.azure.cli.core: Loaded 1238 groups, 4914 commands.
cli.azure.cli.core: Updated command index in 0.003 seconds.
cli.knack.cli: Event: CommandInvoker.OnPreCommandTableTruncate []
cli.azure.cli.core.azlogging: metadata file logging enabled - writing logs to 'C:\Users\antmarti\.azure\commands\2025-06-27.09-11-34.group_export.40116.log'.
az_command_data_logger: command args: group export -n {} --verbose --debug
cli.knack.cli: Event: CommandInvoker.OnPreArgumentLoad [.add_subscription_parameter at 0x041A6488>]
cli.knack.cli: Event: CommandInvoker.OnPostArgumentLoad []
cli.knack.cli: Event: CommandInvoker.OnPostCommandTableCreate [.add_ids_arguments at 0x041A6438>, .add_cache_arguments at 0x041D8938>, .update_breaking_change_info at 0x041D88E8>]
cli.knack.cli: Event: CommandInvoker.OnCommandTableLoaded []
cli.knack.cli: Event: CommandInvoker.OnPreParseArgs []
cli.knack.cli: Event: CommandInvoker.OnPostParseArgs [, , .parse_ids_arguments at 0x041D8988>, ]
cli.azure.cli.core.commands.client_factory: Getting management service client client_type=ResourceManagementClient
cli.azure.cli.core.auth.persistence: build_persistence: location='C:\\Users\\antmarti\\.azure\\msal_token_cache.bin', encrypt=True
cli.azure.cli.core.auth.binary_cache: load: C:\Users\antmarti\.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/72f988bf-86f1-41af-91ab-2d7cd011db47
msal.authority: openid_config("https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0/.well-known/openid-configuration") = {'token_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/token', 'token_endpoint_auth_methods_supported': ['client_secret_post', 'private_key_jwt', 'client_secret_basic'], 'jwks_uri': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/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/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0', 'request_uri_parameter_supported': False, 'userinfo_endpoint': 'https://graph.microsoft.com/oidc/userinfo', 'authorization_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/authorize', 'device_authorization_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/oauth2/v2.0/devicecode', 'http_logout_supported': True, 'frontchannel_logout_supported': True, 'end_session_endpoint': 'https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/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/72f988bf-86f1-41af-91ab-2d7cd011db47/kerberos', 'tenant_region_scope': 'WW', '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? True
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: 7ad2f67a-43bc-4832-8020-c2b31dea41a3
cli.azure.cli.core.sdk.policies: Request URL: 'https://management.azure.com/subscriptions/390ba170-3e2a-41c4-b372-15d9c5ae6e81/resourcegroups/ang-rg1/exportTemplate?api-version=2024-11-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: 'Content-Length': '20'
cli.azure.cli.core.sdk.policies: 'Accept': 'application/json'
cli.azure.cli.core.sdk.policies: 'x-ms-client-request-id': '3e07e2c8-5358-11f0-a3f8-20c19b4ac346'
cli.azure.cli.core.sdk.policies: 'CommandName': 'group export'
cli.azure.cli.core.sdk.policies: 'ParameterSetName': '-n --verbose --debug'
cli.azure.cli.core.sdk.policies: 'User-Agent': 'AZURECLI/2.74.0 (MSI) azsdk-python-core/1.31.0 Python/3.12.10 (Windows-11-10.0.26100-SP0)'
cli.azure.cli.core.sdk.policies: 'Authorization': '*****'
cli.azure.cli.core.sdk.policies: Request body:
cli.azure.cli.core.sdk.policies: {"resources": ["*"]}
urllib3.connectionpool: Starting new HTTPS connection (1): management.azure.com:443
urllib3.connectionpool: https://management.azure.com:443 "POST /subscriptions/390ba170-3e2a-41c4-b372-15d9c5ae6e81/resourcegroups/ang-rg1/exportTemplate?api-version=2024-11-01 HTTP/1.1" 200 179
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': '179'
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: 'x-ms-ratelimit-remaining-subscription-reads': '1099'
cli.azure.cli.core.sdk.policies: 'x-ms-ratelimit-remaining-subscription-global-reads': '16499'
cli.azure.cli.core.sdk.policies: 'x-ms-request-id': '20213ace-72dc-4ff6-b4df-9fa237c1c69c'
cli.azure.cli.core.sdk.policies: 'x-ms-correlation-request-id': '20213ace-72dc-4ff6-b4df-9fa237c1c69c'
cli.azure.cli.core.sdk.policies: 'x-ms-routing-request-id': 'EASTUS:20250627T131135Z:20213ace-72dc-4ff6-b4df-9fa237c1c69c'
cli.azure.cli.core.sdk.policies: 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
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: 40C493451D7C41C3BAA1B8ABA60667D4 Ref B: MNZ221060610027 Ref C: 2025-06-27T13:11:35Z'
cli.azure.cli.core.sdk.policies: 'Date': 'Fri, 27 Jun 2025 13:11:35 GMT'
cli.azure.cli.core.sdk.policies: Response content:
cli.azure.cli.core.sdk.policies: Body is streamable
cli.knack.cli: Event: CommandInvoker.OnTransformResult [, ]
cli.knack.cli: Event: CommandInvoker.OnFilterResult []
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"resources": [],
"variables": {}
}
cli.knack.cli: Event: Cli.SuccessfulExecute []
cli.knack.cli: Event: Cli.PostExecute []
az_command_data_logger: exit code: 0
cli.__main__: Command ran in 4.918 seconds (init: 0.486, invoke: 4.432)
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 3867 in cache file under C:\Users\antmarti\.azure\telemetry\20250627091135689
telemetry.main: Begin creating telemetry upload process.
telemetry.process: Creating upload process: "C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\Lib\site-packages\azure\cli\telemetry\__init__.pyc C:\Users\antmarti\.azure C:\Users\antmarti\.azure\telemetry\20250627091135689"
telemetry.process: Return from creating process 22548
telemetry.main: Finish creating telemetry upload process.
```

### Expected behavior

Response body JSON is logged

### Environment Summary

```
azure-cli 2.74.0

core 2.74.0
telemetry 1.1.0

Extensions:
azure-devops 1.0.2

Dependencies:
msal 1.32.3
azure-mgmt-resource 23.3.0

Python location 'C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\python.exe'
Config directory 'C:\Users\antmarti\.azure'
Extensions directory 'C:\Users\antmarti\.azure\cliextensions'

Python (Windows) 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 11:58:42) [MSC v.1943 32 bit (Intel)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.
```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.