Azure-cli: Unable to `list-owned-objects`

Created on 4 Jun 2019  路  8Comments  路  Source: Azure/azure-cli

This is autogenerated. Please review and update as needed.

Describe the bug

Wanted to check whether or not I had created a secret to permit my AKS cluster to docker pull images from my ACR.
(Yes, I am logged in, and yes, I can list/view both the AKS and the ACR both through az and kubectl - logged in through az).

Command Name
az ad signed-in-user list-owned-objects

Errors:

Object of type 'bytearray' is not JSON serializable
Traceback (most recent call last):
python3.6/site-packages/knack/cli.py, ln 212, in invoke
    self.output.out(cmd_result, formatter=formatter, out_file=out_file)
python3.6/site-packages/knack/output.py, ln 132, in out
    output = formatter(obj)
python3.6/site-packages/knack/output.py, ln 40, in format_json
    separators=(',', ': ')) + '\n'
lib/python3.6/json/__init__.py, ln 238, in dumps
    **kw).encode(obj)
...
lib/python3.6/json/encoder.py, ln 437, in _iterencode
    o = _default(o)
python3.6/site-packages/knack/output.py, ln 32, in default
    return json.JSONEncoder.default(self, o)
lib/python3.6/json/encoder.py, ln 180, in default
    o.__class__.__name__)
TypeError: Object of type 'bytearray' is not JSON serializable

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

Expected Behavior

Output a JSON object, potentially containing data.

Environment Summary

Linux-4.15.0-50-generic-x86_64-with-debian-buster-sid
Python 3.6.5
Shell: bash

azure-cli 2.0.65

Additional Context


Graph-cli bug

Most helpful comment

@jmwoloso I see now that they (probably forgot) didn't mention it here on the thread, but I was told - by reply to the email I sent them - that the fix would be published in a release estimated for two weeks hence, back then.

In other words, in one week.

Just keep an eye on releases and whether or not the referenced commit above is included =)

(I'd presume they closed it not due to reports of it being fixed, but because of a fix being in the pipeline for release).

All 8 comments

@yugangw-msft @marstr
Am encountering the same error when calling the az ad signed-in-user list-owned-objects command as well. Any updates on this issue?

Workaround

Looks like it's just the JSON output format that's failing.

Running with table or tsv format seems to work:

az ad signed-in-user list-owned-objects --output tsv

Can anyone please capture a trace on the wire and share with me at yugangw at microsoft dot com?
The instruction can be found here. --debug should also do.

@yugangw-msft I'll try to re-create the stacktrace and send you via email tomorrow (in 12-18 hours).
Currently @ home without access to set-up.

@yugangw-msft Email sent =) (from a gmail.com address)

@marstr This is still effecting the Linux CLI tool.

Command arguments: ['ad', 'signed-in-user', 'list-owned-objects', '--debug']
Event: Cli.PreExecute []
Event: CommandParser.OnGlobalArgumentsCreate [<function CLILogging.on_global_arguments at 0x7ff4ff71cd90>, <function OutputProducer.on_global_arguments at 0x7ff4ff254bf8>, <function CLIQuery.on_global_arguments at 0x7ff4feff8c80>]
Event: CommandInvoker.OnPreCommandTableCreate []
Installed command modules ['acr', 'acs', 'advisor', 'ams', 'appservice', 'backup', 'batch', 'batchai', 'billing', 'botservice', 'cdn', 'cloud', 'cognitiveservices', 'configure', 'consumption', 'container', 'cosmosdb', 'deploymentmanager', 'dla', 'dls', 'dms', 'eventgrid', 'eventhubs', 'extension', 'feedback', 'find', 'hdinsight', 'interactive', 'iot', 'iotcentral', 'keyvault', 'kusto', 'lab', 'maps', 'monitor', 'natgateway', 'network', 'policyinsights', 'privatedns', 'profile', 'rdbms', 'redis', 'relay', 'reservations', 'resource', 'role', 'search', 'security', 'servicebus', 'servicefabric', 'signalr', 'sql', 'sqlvm', 'storage', 'vm']
Loaded module 'acr' in 0.004 seconds.
Loaded module 'acs' in 0.013 seconds.
Loaded module 'advisor' in 0.001 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'ams' in 0.005 seconds.
Loaded module 'appservice' in 0.006 seconds.
Loaded module 'backup' in 0.002 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'batch' in 0.008 seconds.
Loaded module 'batchai' in 0.002 seconds.
Loaded module 'billing' in 0.001 seconds.
Loaded module 'botservice' in 0.002 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'cdn' in 0.002 seconds.
Loaded module 'cloud' in 0.001 seconds.
Loaded module 'cognitiveservices' in 0.001 seconds.
Loaded module 'configure' in 0.001 seconds.
Loaded module 'consumption' in 0.002 seconds.
Loaded module 'container' in 0.002 seconds.
Loaded module 'cosmosdb' in 0.003 seconds.
Loaded module 'deploymentmanager' in 0.002 seconds.
Loaded module 'dla' in 0.005 seconds.
Loaded module 'dls' in 0.003 seconds.
Loaded module 'dms' in 0.002 seconds.
Loaded module 'eventgrid' in 0.003 seconds.
Loaded module 'eventhubs' in 0.003 seconds.
Loaded module 'extension' in 0.001 seconds.
Loaded module 'feedback' in 0.001 seconds.
Loaded module 'find' in 0.001 seconds.
Loaded module 'hdinsight' in 0.002 seconds.
Loaded module 'interactive' in 0.000 seconds.
Loaded module 'iot' in 0.004 seconds.
Loaded module 'iotcentral' in 0.001 seconds.
Loaded module 'keyvault' in 0.004 seconds.
Loaded module 'kusto' in 0.002 seconds.
Loaded module 'lab' in 0.003 seconds.
Loaded module 'maps' in 0.001 seconds.
Loaded module 'monitor' in 0.004 seconds.
Loaded module 'natgateway' in 0.002 seconds.
Loaded module 'network' in 0.027 seconds.
Loaded module 'policyinsights' in 0.002 seconds.
Loaded module 'privatedns' in 0.005 seconds.
Loaded module 'profile' in 0.001 seconds.
Loaded module 'rdbms' in 0.006 seconds.
Loaded module 'redis' in 0.002 seconds.
Loaded module 'relay' in 0.003 seconds.
Loaded module 'reservations' in 0.003 seconds.
Loaded module 'resource' in 0.008 seconds.
Loaded module 'role' in 0.005 seconds.
Loaded module 'search' in 0.002 seconds.
Loaded module 'security' in 0.003 seconds.
Loaded module 'servicebus' in 0.008 seconds.
Loaded module 'servicefabric' in 0.003 seconds.
Loaded module 'signalr' in 0.004 seconds.
Loaded module 'sql' in 0.011 seconds.
Loaded module 'sqlvm' in 0.006 seconds.
Event: CommandLoader.OnLoadCommandTable []
Loaded module 'storage' in 0.048 seconds.
Loaded module 'vm' in 0.016 seconds.
Loaded all modules in 0.260 seconds. (note: there's always an overhead with the first module loaded)
Extensions directory: '/home/jason/.azure/cliextensions'
Event: CommandInvoker.OnPreCommandTableTruncate [<function AzCliLogging.init_command_file_logging at 0x7ff4fef7ed08>]
az_command_data_logger : command args: ad signed-in-user list-owned-objects --debug
metadata file logging enabled - writing logs to '/home/jason/.azure/commands'.
Event: CommandInvoker.OnPostCommandTableCreate [<function register_global_subscription_argument.<locals>.add_subscription_parameter at 0x7ff4fefa0c80>, <function register_ids_argument.<locals>.add_ids_arguments at 0x7ff4fef526a8>, <function register_cache_arguments.<locals>.add_cache_arguments at 0x7ff4fef52840>]
Event: CommandInvoker.OnCommandTableLoaded []
Event: CommandInvoker.OnPreParseArgs [<function _documentdb_deprecate at 0x7ff4fcbc5ea0>]
Event: CommandInvoker.OnPostParseArgs [<function OutputProducer.handle_output_argument at 0x7ff4ff254c80>, <function CLIQuery.handle_query_parameter at 0x7ff4feff8d08>, <function register_ids_argument.<locals>.parse_ids_arguments at 0x7ff4fef52730>, <function handler at 0x7ff4fca601e0>]
msrest.universal_http.requests : Configuring retry: max_retries=4, backoff_factor=0.8, max_backoff=90
msrest.async_paging : Paging async iterator protocol is not available for DirectoryObjectPaged
attempting to read file /home/jason/.azure/accessTokens.json as utf-8-sig
adal-python : 9f8797e3-aa61-4ae2-9f15-5c9304d95797 - Authority:Performing instance discovery: ...
adal-python : 9f8797e3-aa61-4ae2-9f15-5c9304d95797 - Authority:Performing static instance discovery
adal-python : 9f8797e3-aa61-4ae2-9f15-5c9304d95797 - Authority:Authority validated via static instance discovery
adal-python : 9f8797e3-aa61-4ae2-9f15-5c9304d95797 - TokenRequest:Getting token from cache with refresh if necessary.
adal-python : 9f8797e3-aa61-4ae2-9f15-5c9304d95797 - CacheDriver:finding with query keys: {'_clientId': '...', 'userId': '...'}
adal-python : 9f8797e3-aa61-4ae2-9f15-5c9304d95797 - CacheDriver:Looking for potential cache entries: {'_clientId': '...', 'userId': '...'}
adal-python : 9f8797e3-aa61-4ae2-9f15-5c9304d95797 - CacheDriver:Found 3 potential entries.
adal-python : 9f8797e3-aa61-4ae2-9f15-5c9304d95797 - CacheDriver:Resource specific token found.
adal-python : 9f8797e3-aa61-4ae2-9f15-5c9304d95797 - CacheDriver:Returning token from cache lookup, AccessTokenId: b'9Px+D0z5xBxrGYwlrdYMXLR9S9XRq58e2FiZDb5Cvys=', RefreshTokenId: b'H4K91ACraNnfFm/u595JVZs99/DGhHacgEKxjv4tgWY='
msrest.http_logger : Request URL: 'https://graph.windows.net/4d1624e8-5511-40de-b658-38621b4e2cb4/me/ownedObjects?api-version=1.6'
msrest.http_logger : Request method: 'GET'
msrest.http_logger : Request headers:
msrest.http_logger :     'Accept': 'application/json'
msrest.http_logger :     'accept-language': 'en-US'
msrest.http_logger :     'User-Agent': 'python/3.6.5 (Linux-4.15.0-52-generic-x86_64-with-debian-buster-sid) msrest/0.6.7 msrest_azure/0.6.1 azure-graphrbac/0.60.0 Azure-SDK-For-Python AZURECLI/2.0.67'
msrest.http_logger : Request body:
msrest.http_logger : None
msrest.universal_http : Configuring redirects: allow=True, max=30
msrest.universal_http : Configuring request: timeout=100, verify=True, cert=None
msrest.universal_http : Configuring proxies: ''
msrest.universal_http : Evaluate proxies against ENV settings: True
urllib3.connectionpool : Starting new HTTPS connection (1): graph.windows.net:443
urllib3.connectionpool : https://graph.windows.net:443 "GET /4d1624e8-5511-40de-b658-38621b4e2cb4/me/ownedObjects?api-version=1.6 HTTP/1.1" 200 3683
msrest.http_logger : Response status: 200
msrest.http_logger : Response headers:
msrest.http_logger :     'Cache-Control': 'no-cache'
msrest.http_logger :     'Pragma': 'no-cache'
msrest.http_logger :     'Content-Type': 'application/json; odata=minimalmetadata; streaming=true; charset=utf-8'
msrest.http_logger :     'Expires': '-1'
msrest.http_logger :     'ocp-aad-diagnostics-server-name': 'WqKhWXvl1okXb47qljo0lPbR3WueJ7PneT8ez1L9elM='
msrest.http_logger :     'request-id': '4edbc19b-1e67-4e11-abb4-f92b13b2c458'
msrest.http_logger :     'client-request-id': 'bf72c347-978c-11e9-b39f-983b8f8c6b26'
msrest.http_logger :     'x-ms-dirapi-data-contract-version': '1.6'
msrest.http_logger :     'ocp-aad-session-key': 'B5Et2Vg61WyvsfCeRiuHCQG4ymDWU0uqPA9Q0J9DBx6JyJZe1q6FND-7J_V_j2VHfhok5fkecmFLsqdFRegYV20EOf6FGKPD2L1J_46V__5yPqSR2SlKgcR5IzoJzxRmOQ5ILREIm6Wr8s5eeTePcw.NKnuAcHGx_TStOf9GV9Fy99iM8vNptTNIK4JatYR0no'
msrest.http_logger :     'DataServiceVersion': '3.0;'
msrest.http_logger :     'Strict-Transport-Security': 'max-age=31536000; includeSubDomains'
msrest.http_logger :     'Access-Control-Allow-Origin': '*'
msrest.http_logger :     'X-AspNet-Version': '4.0.30319'
msrest.http_logger :     'X-Powered-By': 'ASP.NET'
msrest.http_logger :     'Duration': '728133'
msrest.http_logger :     'Date': 'Tue, 25 Jun 2019 21:03:55 GMT'
msrest.http_logger :     'Content-Length': '3683'
msrest.http_logger : Response content:
msrest.http_logger : {"odata.metadata":"https://graph.windows.net/4d1624e8-5511-40de-b658-38621b4e2cb4/$metadata#directoryObjects","value":[{"odata.type":"Microsoft.DirectoryServices.Application","objectType":"Application","objectId":"d45ddc9f-fe0b-4b4c-8e7f-40641c6677ff","deletionTimestamp":null,"acceptMappedClaims":null,"addIns":[],"appId":"6ee2ff02-baaf-4282-8276-d067ec2191f0","applicationTemplateId":null,"appRoles":[],"availableToOtherTenants":false,"displayName":"jason_poc","errorUrl":null,"groupMembershipClaims":null,"homepage":"https://jason_poc","identifierUris":["http://jason_poc"],"informationalUrls":{"termsOfService":null,"support":null,"privacy":null,"marketing":null},"isDeviceOnlyAuthSupported":null,"keyCredentials":[],"knownClientApplications":[],"logoutUrl":null,"[email protected]":"directoryObjects/d45ddc9f-fe0b-4b4c-8e7f-40641c6677ff/Microsoft.DirectoryServices.Application/logo","logoUrl":null,"[email protected]":"directoryObjects/d45ddc9f-fe0b-4b4c-8e7f-40641c6677ff/Microsoft.DirectoryServices.Application/mainLogo","oauth2AllowIdTokenImplicitFlow":true,"oauth2AllowImplicitFlow":false,"oauth2AllowUrlPathMatching":false,"oauth2Permissions":[{"adminConsentDescription":"Allow the application to access jason_poc on behalf of the signed-in user.","adminConsentDisplayName":"Access jason_poc","id":"4a5a0076-0735-4f4c-bb50-afb5d9f67c3c","isEnabled":true,"type":"User","userConsentDescription":"Allow the application to access jason_poc on your behalf.","userConsentDisplayName":"Access jason_poc","value":"user_impersonation"}],"oauth2RequirePostResponse":false,"optionalClaims":null,"orgRestrictions":[],"parentalControlSettings":{"countriesBlockedForMinors":[],"legalAgeGroupRule":"Allow"},"passwordCredentials":[{"customKeyIdentifier":"//5yAGIAYQBjAA==","endDate":"2020-06-25T20:44:50.509507Z","keyId":"b517e2cc-ed44-46e4-9c30-363c454ab68d","startDate":"2019-06-25T20:44:50.509507Z","value":null}],"publicClient":null,"publisherDomain":"LighthouseeDiscovery.onmicrosoft.com","recordConsentConditions":null,"replyUrls":[],"requiredResourceAccess":[],"samlMetadataUrl":null,"signInAudience":"AzureADMyOrg","tokenEncryptionKeyId":null},{"odata.type":"Microsoft.DirectoryServices.ServicePrincipal","objectType":"ServicePrincipal","objectId":"991f038a-51c7-4c5d-a18c-bd26cb686d39","deletionTimestamp":null,"accountEnabled":true,"addIns":[],"alternativeNames":[],"appDisplayName":"jason_poc","appId":"6ee2ff02-baaf-4282-8276-d067ec2191f0","applicationTemplateId":null,"appOwnerTenantId":"4d1624e8-5511-40de-b658-38621b4e2cb4","appRoleAssignmentRequired":false,"appRoles":[],"displayName":"jason_poc","errorUrl":null,"homepage":"https://jason_poc","informationalUrls":{"termsOfService":null,"support":null,"privacy":null,"marketing":null},"keyCredentials":[],"logoutUrl":null,"notificationEmailAddresses":[],"oauth2Permissions":[{"adminConsentDescription":"Allow the application to access jason_poc on behalf of the signed-in user.","adminConsentDisplayName":"Access jason_poc","id":"4a5a0076-0735-4f4c-bb50-afb5d9f67c3c","isEnabled":true,"type":"User","userConsentDescription":"Allow the application to access jason_poc on your behalf.","userConsentDisplayName":"Access jason_poc","value":"user_impersonation"}],"passwordCredentials":[],"preferredSingleSignOnMode":null,"preferredTokenSigningKeyEndDateTime":null,"preferredTokenSigningKeyThumbprint":null,"publisherName":"Lighthouse eDiscovery","replyUrls":[],"samlMetadataUrl":null,"samlSingleSignOnSettings":null,"servicePrincipalNames":["http://jason_poc","6ee2ff02-baaf-4282-8276-d067ec2191f0"],"servicePrincipalType":"Application","signInAudience":"AzureADMyOrg","tags":[],"tokenEncryptionKeyId":null}]}
Event: CommandInvoker.OnTransformResult [<function _resource_group_transform at 0x7ff4fef470d0>, <function _x509_from_base64_to_hex_transform at 0x7ff4fef47158>]
Event: CommandInvoker.OnFilterResult []
cli.azure.cli.core.util : The command failed with an unexpected error. Here is the traceback:

The command failed with an unexpected error. Here is the traceback:

cli.azure.cli.core.util : Object of type 'bytearray' is not JSON serializable
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 212, in invoke
    self.output.out(cmd_result, formatter=formatter, out_file=out_file)
  File "/opt/az/lib/python3.6/site-packages/knack/output.py", line 132, in out
    output = formatter(obj)
  File "/opt/az/lib/python3.6/site-packages/knack/output.py", line 40, in format_json
    separators=(',', ': ')) + '\n'
  File "/opt/az/lib/python3.6/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/opt/az/lib/python3.6/json/encoder.py", line 201, in encode
    chunks = list(chunks)
  File "/opt/az/lib/python3.6/json/encoder.py", line 428, in _iterencode
    yield from _iterencode_list(o, _current_indent_level)
  File "/opt/az/lib/python3.6/json/encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "/opt/az/lib/python3.6/json/encoder.py", line 404, in _iterencode_dict
    yield from chunks
  File "/opt/az/lib/python3.6/json/encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "/opt/az/lib/python3.6/json/encoder.py", line 404, in _iterencode_dict
    yield from chunks
  File "/opt/az/lib/python3.6/json/encoder.py", line 437, in _iterencode
    o = _default(o)
  File "/opt/az/lib/python3.6/site-packages/knack/output.py", line 32, in default
    return json.JSONEncoder.default(self, o)
  File "/opt/az/lib/python3.6/json/encoder.py", line 180, in default
    o.__class__.__name__)
TypeError: Object of type 'bytearray' is not JSON serializable
Object of type 'bytearray' is not JSON serializable
Traceback (most recent call last):
  File "/opt/az/lib/python3.6/site-packages/knack/cli.py", line 212, in invoke
    self.output.out(cmd_result, formatter=formatter, out_file=out_file)
  File "/opt/az/lib/python3.6/site-packages/knack/output.py", line 132, in out
    output = formatter(obj)
  File "/opt/az/lib/python3.6/site-packages/knack/output.py", line 40, in format_json
    separators=(',', ': ')) + '\n'
  File "/opt/az/lib/python3.6/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/opt/az/lib/python3.6/json/encoder.py", line 201, in encode
    chunks = list(chunks)
  File "/opt/az/lib/python3.6/json/encoder.py", line 428, in _iterencode
    yield from _iterencode_list(o, _current_indent_level)
  File "/opt/az/lib/python3.6/json/encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "/opt/az/lib/python3.6/json/encoder.py", line 404, in _iterencode_dict
    yield from chunks
  File "/opt/az/lib/python3.6/json/encoder.py", line 325, in _iterencode_list
    yield from chunks
  File "/opt/az/lib/python3.6/json/encoder.py", line 404, in _iterencode_dict
    yield from chunks
  File "/opt/az/lib/python3.6/json/encoder.py", line 437, in _iterencode
    o = _default(o)
  File "/opt/az/lib/python3.6/site-packages/knack/output.py", line 32, in default
    return json.JSONEncoder.default(self, o)
  File "/opt/az/lib/python3.6/json/encoder.py", line 180, in default
    o.__class__.__name__)
TypeError: Object of type 'bytearray' is not JSON serializable

@jmwoloso I see now that they (probably forgot) didn't mention it here on the thread, but I was told - by reply to the email I sent them - that the fix would be published in a release estimated for two weeks hence, back then.

In other words, in one week.

Just keep an eye on releases and whether or not the referenced commit above is included =)

(I'd presume they closed it not due to reports of it being fixed, but because of a fix being in the pipeline for release).

@x10an14 perfect, thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

williexu picture williexu  路  3Comments

seanknox picture seanknox  路  3Comments

oakeyc picture oakeyc  路  3Comments

idkjs picture idkjs  路  3Comments

dhermans picture dhermans  路  3Comments