Microgrid is a small-scale cyber-physical system, and it generally suffers from various uncertainties. In this paper, we investigate the secure control problem of a benchmark microgrid with system uncertainties by using data-driven edge computing technology. First, the state-space function of the benchmark microgrid system is formulated, and parameter uncertainties are taken into consideration. Second, a novel data-driven intelligent computing method is derived from the model-based reinforcement learning algorithm, which only requires system data instead of system models. By utilizing this computing method, the optimal control policy can be obtained in the model-free environment. Third, the Lyapunov stability theory is employed to prove that the uncertain microgrid can be asymptotically stabilized under the optimal control policy. Finally, simulation results demonstrate the control performance can be improved by tuning the parameters in the performance index function.