Is this a proper way to connect a piezo speaker to MCU?
Not all piezoelectric buzzers are made equal, 

Basically you have the very simple ones, those are only a sort of a small piezoelectric speaker, (like those old Motorola tweeters, all plastic case, no magnet), beware; those are destroyed by DC, so use a capacitor (0.01 uf) to avoid dc going through the transducer, and make sure that you are feeding the beast with some square or sinusoidal wave, 
and..
Then the piezo buzzers that have a built-in oscillator/driver circuit, that drive the piezoelectric element, with those you must have the specs of the buzzer, but I have found that most of them behave well with 5 Volts dc. mass production have made them dirt cheap.