Following example in :
https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/keyvault/azure-keyvault-keys
whenever I run the below code :
rsa_key = key_client.create_rsa_key("rsa-key-demo", size=2048)
print(rsa_key.name)
print(rsa_key.key_type)
The key will be created in my Azure keyVult, however I always get the following error :
Traceback (most recent call last): File "c:/Users/user/Desktop/azure_keyValut_demo.py", line 152, in rsa_key = key_client.create_rsa_key("rsa-key-demo", size=2048) File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\azure\core\tracing\decorator.py", line 62, in wrapper_use_tracer return func(*args, **kwargs) # type: ignore File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\azure\keyvault\keys_client.py", line 131, in create_rsa_key return self.create_key(name, key_type="RSA-HSM" if hsm else "RSA", **kwargs) File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\azure\core\tracing\decorator.py", line 62, in wrapper_use_tracer return func(*args, **kwargs) # type: ignore File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\azure\keyvault\keys_client.py", line 96, in create_key **kwargs File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\azure\keyvault\keys_shared_generated\v7_0\operations_key_vault_client_operations.py", line 96, in create_key deserialized = self._deserialize('KeyBundle', response) File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\msrest\serialization.py", line 1180, in call data = self._unpack_content(response_data, content_type) File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\msrest\serialization.py", line 1334, in unpack_content return json.loads(data) File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\json_init.py", line 348, in loads 'not {!r}'.format(s.class.name)) TypeError: the JSON object must be str, bytes or bytearray, not 'method'
I didn't quite understand why that exception is being thrown.
I found this on stackoverflow but still couldn't understand what's going on:
Why won't python3 load this json string?
The code run successfully with no issues with Python2.7
The exception will be thrown for all key operations (create, delete, get)
It also happens with all Cryptographic operations