Considering the uncertainty of wind power generation and photovoltaic generation, the stochastic chance constrained programming model was used to construct the optimal operation model of CCHP microgrid. Taking the chance constrained form of comprehensive system operation cost as objective function and taking into account the necessary constraints of power balance constraints, a model based on stochastic chance constrained programming was proposed for optimal operation of CCHP microgrid. The proposed model can take full account of the uncertainty of the wind power and photovoltaic power output in the system, thus the optimized operation scheme is based on the random distribution of the wind and scenery, so it is more global and economic. The simulation example shows that the operating cost of the system under the grid connected mode is significantly lower than that under the grid off mode. Through the model, the relationship between the cost of the system and the risk in the process of optimizing the operation scheme can be given, so as to provide a reference for the decision-makers.