Understanding the role of the host genome in modulating microbiota variation is a need to shed light on the holobiont theory and overcome the current limits on the description of host-microbiota interactions at the genomic and molecular levels. However, the host genetic architecture structuring microbiota is only partly described in plants. In addition, most association genetic studies on microbiota are often carried out outside the native habitats where the host evolves and the identification of signatures of local adaptation on the candidate genes has been overlooked. To fill these gaps and dissect the genetic architecture driving adaptive plant-microbiota interactions, we adopted a Genome-Environmental-Association (GEA) analysis on 141 whole-genome sequenced natural populations of Arabidopsis thaliana characterized in situ for their leaf and root bacterial communities in fall and spring, and a large range of non-microbial ecological factors (i.e. climate, soil and plant communities). A much higher fraction of among-population microbiota variance was explained by the host genetics than by non-microbial ecological factors. Importantly, the relative importance of host genetics and non-microbial ecological factors in explaining the presence of particular OTUs differs between bacterial families and genera. In addition, the polygenic architecture of adaptation to bacterial communities was highly flexible between plant compartments and seasons. Relatedly, signatures of local adaptation were stronger on QTLs of the root microbiota in spring. Finally, plant immunity appears as a major source of adaptive genetic variation structuring bacterial assemblages in A. thaliana.