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)