I got it sorted by using the following codes.
Getting the Token by using this sample code from MS:
certificate_credentials_sample.py
Then adding the following lines:
from msrestazure.azure_active_directory import AADTokenCredentials
from azure.mgmt.compute import ComputeManagementClient
client_id = 'XXXXXXXXXXXXX'
credentials = AADTokenCredentials(token, client_id)
compute_client = ComputeManagementClient(credentials, subscription_id)
resourceGroup = 'XXXXXXXXXXXX'
for vm in compute_client.virtual_machines.list(resourceGroup):
print(vm)
The parameters.json
{
"resource" : "https://management.azure.com",
"tenant" : "XXXXXXXXXXXXXXXXXXXX",
"authorityHostUrl" : "https://login.microsoftonline.com",
"clientId" : "XXXXXXXXXXXXXXXXXXXX",
"thumbprint" : "XXXXXXXXXXXXXXXXXXXX",
"privateKeyFile" : "XXXXXXXXXXXXXXXXXXXX.pem"
}