We study multiclass many-server queues for which the arrival, service and abandonment rates are all modulated by a common finite-state Markov process. We assume that the system operates in the "averaged" Halfin-Whitt regime, which means that it is critically loaded in the average sense, although not necessarily in each state of the Markov process. We show that under any static priority policy, the Markov-modulated diffusion-scaled queueing process is geometrically ergodic. This is accomplished by employing a solution to an associated Poisson equation in order to construct a suitable Lyapunov function. We establish a functional central limit theorem for the diffusion-scaled queueing process and show that the limiting process is a controlled diffusion with piecewise linear drift and constant covariance matrix. We address the infinite-horizon discounted and long-run average (ergodic) optimal control problems and establish asymptotic optimality.We first establish a FCLT for the Markov-modulated diffusion-scaled queueing processes under any admissible scheduling policy (only considering work-conserving and preemptive policies). Proper scaling is needed in order to establish weak convergence of the queueing processes. In particular, since the arrival processes are of order n, and the switching rates of the background process are assumed to be of order n α for α > 0, the queueing processes are centered at the 'averaged' steady state, which is of order n, and are then scaled down by a factor of an n β , with β := max{ 1 /2, 1− α /2}, in the diffusion scale. Thus, when α ≥ 1, we have the usual diffusion scaling with β = 1 /2, which is due to the fact that the very fast switching of the environment results in an 'averaging' effect for the arrival, service and abandonment processes of the queueing dynamics. The limit queueing process is a piecewise Ornstein-Uhlenbeck diffusion process with a drift and covariance given by the corresponding 'averaged' quantities under the stationary distribution of the background process. When α = 1, both the variabilities of the queueing and background processes are captured in the covariance matrix, while when α > 1, only the variabilities of the queueing process is captured. On the other hand, when α < 1, the proper diffusion scaling requires β = 1 − α /2, for which we obtain a similar piecewise Ornstein-Uhlenbeck diffusion process with the covariance matrix capturing the variabilities of the background process only.The ergodic properties of this class of piecewise linear diffusions (and Lévy-driven stochastic differential equations) have been studied in [6,13], and these results can be applied directly to our model. The study of the ergodic properties of the diffusion-scaled processes, however, is challenging. Ergodicity of switching Markov processes has been an active research subject. For switching diffusions, stability has been studied in [18,19,21]. However, studies of ergodicity of switching Markov processes are scarce. Recently in [8,9], some kind of hypoellipticity criterion with H...