A microgrid can be formed by the integration of different components such as loads, renewable/conventional units, and energy storage systems in a local area. Microgrids with the advantages of being flexible, environmentally friendly, and self-sufficient can improve the power system performance metrics such as resiliency and reliability. However, the design and implementation of microgrids are always faced with different challenges considering the uncertainties associated with loads and renewable energy resources, sudden load variations, energy management of several energy resources, etc. Therefore, it is required to employ such rapid and accurate methods, as artificial intelligence (AI) techniques, to address these challenges and improve the MG's efficiency, stability, security, and reliability. Utilization of AI helps to develop systems as intelligent as humans to learn, decide, and solve problems. This article presents a review on different applications of AI-based techniques in microgrids such as energy management, load and generation forecasting, protection, power electronics control, and cyber security. Different AI tasks such as regression and classification in microgrids are discussed using methods including machine learning, artificial neural networks, fuzzy logic, support vector machines, etc. The advantages, limitation, and future trends of AI applications in microgrids are discussed.