I have written python code to get azure resources for a subscription using azure-python sdk, the function to list all the resources inside a resource group is not working, this was working fine a week before, may be the microsoft have changed their api?? I am getting an attribute error, AttributeError: 'ResourceGroupsOperations' object has no attribute 'list_resources'
Please Find the code below,
from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.resource.resources import ResourceManagementClient
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.network import NetworkManagementClient
subscription_id = ''
credentials = ServicePrincipalCredentials(
client_id = '',
secret = '',
tenant = '',
)
resource_client = ResourceManagementClient(credentials,subscription_id)
resource_client.providers.register('Microsoft.Batch')
def get_resources():
for rg in resource_client.resource_groups.list():
for item in resource_client.resource_groups.list_resources(rg.name):
print "%s,%s,%s,%s,"%(item.name,item.type,item.location,rg.name)
get_resources()
Plz do help on this! thanks in advance !