Theoretical forever, as long as they get fresh nutrients and waste is removed, along with all progenitors. Spores (Endospores) of some species have been revived after thousands of dormant years.
Bacterias are microbes are of different types they live for 30 seconds to some time more than hundred years. generally bacterias do not live long time in dry surface where humidity is less.
bacteria can live forever and spread as long as their environment is kept unchanged and is suitable to their needs since bacteria can thrive anywhere, but once you expose it to its weakness it will die.