This sample vs.net project shows how to connect to an azure hosted vm run a query and return the result as json.