The location of the microbiome will determine its source: intestine, skin, lungs, saliva etc. A lot of our initial microbiomes come from our mother from birth, and the rest we acquire throughout life from our environment, what we eat, the air we breathe and the people we meet among other sources.
The immune-system is modulated to not attack beneficial part of our microbiome, have a look at the following three articles, see:
Article Defining the Human Microbiome
Article c-Maf-dependent Treg cell control of intestinal TH17 cells a...
Article Immune tolerance. Group 3 innate lymphoid cells mediate inte...
There are no such things as good microorganisms. A microorganism is "good" only when our body developed immunity against it. Any microorganism that has the chance to invade into our main body is a pathogen, and our immune system will try to kill it and turn it into nutrients. So the benefit of the microbiome are, with the help of our immune system, they are the provider of all our essential nutrients.