Hi Hanno,
Based on the error details you shared, I have shared troubleshooting steps that I felt will help resolve the issue you reported.
If the Load Balancer resource is in use by a Virtual Machine Scale Set and can't be deleted. Use the Azure Resource Manager ID provided in the error message to search for the Virtual Machine Scale Set in order to delete it.
Check if there are any remaining resources linked to the load balancer that might prevent its deletion:
List Network Interfaces: az network nic list --query "[].{Name:name, IPConfigs:ipConfigurations[].{Name:name, LBBackendPools:loadBalancerBackendAddressPools[].id}}"
Check Load Balancer Health Probes: az network lb probe list -g <<RESOURCE_GROUP_NAME>> --lb-name <<LB_NAME>>
Check the Load Balancer details: az network lb show -g <<RESOURCE_GROUP_NAME>> -n <<LB_NAME>>
If you find any dependencies, remove them manually by using the following commands:
For Backend Address Pool: az network lb backend-pool remove --resource-group <<RESOURCE_GROUP_NAME>> --lb-name <<LB_NAME>> --name <<BACKEND_POOL_NAME>> --backend-addresses <ADDRESS>
To remove Load Balancer Rules: az network lb rule delete --resource-group <<RESOURCE_GROUP_NAME>> --lb-name <<LB_NAME>> --name <<RULE_NAME>>
You can also check the dependencies using the Azure Resource Explorer: Go to the Azure Resource Explorer. then Navigate to the load balancer resource and check the JSON properties for any references to the VMSS or other resources that may still exist. If you find any stale references, you can delete them directly from Resource Explorer.
Please let us know if you have any further queries. I’m happy to assist you further.