The potential utilization of black soldier fly (Hermetia illucens) as food or feed is interesting due to the nutritive value and the sustainability of the rearing process. In the present study, larvae and prepupae of H. illucens were reared at 20, 27, and 33 °C, to determine whether temperature affects the whole insect microbiota, described using microbiological risk assessment techniques and 16S rRNA gene survey. The larvae efficiently grew across the tested temperatures. Higher temperatures promoted faster larval development and greater final biomass but also higher mortality. Viable Enterobacteriaceae, Bacillus cereus, Campylobacter, Clostridium perfringens, coagulase-positive staphylococci, Listeriaceae, and Salmonella were detected in prepupae. Campylobacter and Listeriaceae counts got higher with the increasing temperature. Based on 16S rRNA gene analysis, the microbiota of larvae was dominated by Providencia (>60%) and other Proteobateria (mainly Klebsiella) and evolved to a more complex composition in prepupae, with a bloom of Actinobacteria, Bacteroidetes, and Bacilli, while Providencia was still present as the main component. Prepupae largely shared the microbiota with the frass where it was reared, except for few lowly represented taxa. The rearing temperature was negatively associated with the amount of Providencia, and positively associated with a variety of other genera, such as Alcaligenes, Pseudogracilibacillus, Bacillus, Proteus, Enterococcus, Pediococcus, Bordetella, Pseudomonas, and Kerstersia. With respect to the microbiological risk assessment, attention should be paid to abundant genera, such as Bacillus, Myroides, Proteus, Providencia, and Morganella, which encompass species described as opportunistic pathogens, bearing drug resistances or causing severe morbidity.