Get Virtual Machine sizes list in json format using azure-sdk-for-python

前端 未结 1 845
一向
一向 2021-01-27 17:21

I\'m trying to use azure-sdk-for-python library to connect to azure cloud and to execute certain operations.

I followed the below code samples provided in Azure docs to

相关标签:
1条回答
  • 2021-01-27 18:01

    Result of a list call return an iterable, so first you would have to consume this iterable as a list. Then, each object will contain a serialize method that will put back the object into its JSON form.

    In practical terms:

    client = CompteManagementClient(credentials, subscription_id)
    vmSizesList = [vm_size.serialize() for vm_size in client.virtual_machine_sizes.list()]
    json.dumps(vmSizesList)
    
    0 讨论(0)
提交回复
热议问题