I’ve used the below code to get the Access Token from my Azure account.
It’s working fine, I already got the token as well
But when I use below statement, its listing all VM's information, but I need only for one VM I referred to documentation, but it does not have any example for filtering
from azure.mgmt.compute import ComputeManagementClient
from azure.common.credentials import ServicePrincipalCredentials
Subscription_Id = "xxxxx"
Tenant_Id = "xxxxx"
Client_Id = "xxxxx"
Secret = "xxxxx"
credential = ServicePrincipalCredentials(
client_id=Client_Id,
secret=Secret,
tenant=Tenant_Id
)
compute_client = ComputeManagementClient(credential, Subscription_Id)
vm_list = compute_client.virtual_machines.list_all()
How to filter one VM and to output of all vm related info to json