If I run the code I get the above error.
To me it looks as though your example expects a load balancer
resource loadBalancer 'Microsoft.Network/loadBalancers@2021-05-01' existing = {
to be already set up, do you have an example where it creates the load balancer on the fly or am i missing something ?
(I have read that granting permissions will fixes the error above, however do i have to have an existing load balancer already set up to use this example)