I have written this code to list down the Azure Virtual Machine. Now I want to print all the details related to the OS disks such as OS, disk size, encryption settings, and other details related to Azure Virtual Machine
from azure.mgmt.resource import ResourceManagementClient
from azure.identity import ClientSecretCredential
Subscription_Id = "XXXX"
Tenant_Id = "XXXX"
Client_Id = "XXXX"
Secret = "XXXX"
credential = ClientSecretCredential(
client_id=Client_Id,
client_secret=Secret,
tenant_id=Tenant_Id
)
resource_client = ResourceManagementClient(
credential=credential, subscription_id=Subscription_Id)
resource_list = resource_client.resources.list()
for item in resource_list:
if(item.type == 'Microsoft.Compute/virtualMachines'):
print(item.name)
encryptionorstorage_profilehow can I get it" 'name': 'Linux', 'type': 'Microsoft.Compute/virtualMachines', 'location': 'eastus', 'extended_location': None, 'tags': None, 'plan': None, 'properties': None, 'kind': None, 'managed_by': None, 'sku': None, 'identity': None, 'created_time': None, 'changed_time': None, 'provisioning_state': None"os_disk_name = virtual_machine.storage_profile.os_disk.name os_disk = compute_client.disks.get(GROUP_NAME, os_disk_name)as mentioned in this GitHub sample.