Microgrids (MGs) rely on networked control supported by off-the-shelf wireless communications. This makes them vulnerable to cyber-attacks, such as denial-of-service (DoS). In this paper, we mitigate those attacks by applying the concepts of (i) separation of data plane from network control plane, inspired by the software defined networking (SDN) paradigm, and (ii) agile reconfiguration of the data plane connections. In our architecture, all generators operate as either voltage regulators (active agents), or current sources (passive agents), with their operating mode being locally determined, according the global information on the MG state. The software-defined MG control utilizes the fact that, besides the data exchange on the wireless channel, the power-grid bus can be used to create side communication channels that carry control plane information about the state of the MG. For this purpose, we adopt power talk, a modem-less, low-rate, power-line communication designed for direct current (DC) MGs. The results show that the proposed software-defined MG offers superior performance compared to the static MG, as well as resilience against cyber attacks.The cooperation among agents is supported by an external communication network, which can experience delay and packet loss, thereby deteriorating the MG operation. With non-ideal links, the secondary/tertiary control operate in a suboptimal regime. A possible solution is the adoption of robust control schemes that are tolerant against communication delays and/or packet drops, cf. [5]. However, when the communication network is attacked by e.g. Denial of Service (DoS), the secondary/tertiary control fails [6]. In addition to the poor adaptation to communication impairments, another deficiency of existing MG control is the information security: the increase of the number of attacks against big-scale power systems raises a concern also about the cyber-resilience of the small scale grids. In fact, even if the MG failure does not lead to large blackouts, it may damage sensitive loads, such as electronic equipment, or cause the tripping of DERs [7].