We propose a set of boundary terms for higher spin theories in AdS$_3$ that lead to a well-defined variational principle compatible with Dirichlet boundary conditions for the metric and higher spin fields. These boundary terms are valid for higher spin theories in the Fefferman-Graham gauge and they allow us to compute the canonical free energy of higher spin black holes directly from the Euclidean, covariant, on-shell action. Using these results we reproduce the thermodynamics of the higher spin black hole of Ammon, Gutperle, Kraus, and Perlmutter and comment on the corresponding theory of induced $cal{W}$-gravity at the boundary.