The significance of bacteria for eukaryotic functioning is increasingly recognized. Coral reef ecosystems critically rely on the relationship between coral hosts and their intracellular photosynthetic dinoflagellates, but the role of the associated bacteria remains largely theoretical. Here, we set out to relate coral-associated bacterial communities of the fungid host species Ctenactis echinata to environmental settings (geographic location, substrate cover, summer/winter, nutrient and suspended matter concentrations) and coral host abundance. We show that bacterial diversity of C. echinata aligns with ecological differences between sites and that coral colonies sampled at the species? preferred habitats are primarily structured by one bacterial taxon (genus Endozoicomonas) representing more than 60% of all bacteria. In contrast, host microbiomes from lower populated coral habitats are less structured and more diverse. Our study demonstrates that the content and structure of the coral microbiome aligns with environmental differences and denotes habitat adequacy. Availability of a range of coral host habitats might be important for the conservation of distinct microbiome structures and diversity.