It must satisfy Laplace's equation in the x-y plane:
f = f(x,y)
∂2f/∂x2 + ∂2f/∂y2 = 0
In the theory of complex variables, there is a class of functions of complex variables called analytic functions. To be analytic means the derivatives of the function are well defined. Analytic functions satisfy a pair of equations called the Cauchy-Riemann conditions. Consider a complex function F of a complex variable z.
z = x + iy
F = F(z) = u(x,y) +iv(x,y),
where u and v are the real and imaginary parts of F, respectively. If F(z) is analytic, then it must satisfy the Cauchy-Riemann conditions:
∂u/∂x = ∂v/∂y
∂u/∂y = -∂v/∂x
If these 2 conditions are satisfied, then both u(x,y) and v(x,y) also satisfy Laplace's equation in the x-y plane, and hence both u and y are harmonic functions. So you can think of a harmonic function as being either the real or imaginary part of a complex function of a complex variable, where the function is analytic.