How to convert class type to string python sdk

Hassan Turi 21 Reputation points
2022-04-05T18:02:26.833+00:00

I have this code that prints information related to VM. The output is in the class type. How can I convert to a form so that I can understand it?

from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.compute import ComputeManagementClient

credential = ServicePrincipalCredentials(client_id='XXXX',
                                         secret='XXXX', tenant='XXXX')
compute_client = ComputeManagementClient(
    credential, 'XXXX')

for vm in compute_client.virtual_machines.list_all():
    print(type(vm.storage_profile))

The output is of the form

<class 'azure.mgmt.compute.v2019_03_01.models.storage_profile_py3.StorageProfile'>

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,013 questions
0 comments No comments
{count} votes

Accepted answer
  1. deherman-MSFT 38,021 Reputation points Microsoft Employee Moderator
    2022-04-06T20:48:01.263+00:00

    @HassanTuri-3005
    I see you have already posted your question and received some answers on StackOverflow. Hopefully those answers resolve your question, if you still need assistance please let us know.


    Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.