I am trying to list and loop through Azure Resource Locks of a resource group by using Python SDK.
from azure.mgmt.resource.locks.v2016_09_01.aio import ManagementLockClient
management_lock_client = ManagementLockClient(credential, subscription.subscription_id)
locks = management_lock_client.management_locks.list_at_resource_group_level(resource__group_snapshot)
for lock in locks:
management_lock_client.management_locks.delete(resource__group_snapshot, lock.name)
But here, I get the error:
for lock in locks: TypeError: 'AsyncItemPaged' object is not iterable .
I have tried different methods like list() and result() but it didn't work. For the moment, I don't want to use directly the REST API but the Python SDK.
Does someone has any idea?