I'm trying to move a large number of Azure Resources from Azure Resource Group to Azure Resource Group.
My code looks like this:
for i in resource_client.resources.list(filter=f"tagName eq 'run_id' and tagValue eq '{RUN_ID}'"):
print_item(i)
ids.append(i.id)
targetRG = resource_client.resource_groups.get(resource_group_name=DELETE_GROUP_NAME)
for id in ids:
try:
poller = resource_client.resources.move_resources(source_resource_group_name=SOURCE_GROUP_NAME, target_resource_group=targetRG.id, resources=id)
rg_move_result = poller.result()
except:
pass
I'd PREFER not to have the second loop, and just do it in bulk, but if there are any errors in the move, it fails. Is there a way to do all this and just skip errors?