fixed query preparation for calling azure