A critical branching process with immigration which evolves in a random environment is considered. Assuming that immigration is not allowed when there are no individuals in the population, we investigate the tail distribution of the so-called life period of the process, i.e. the length of the time interval between the moment when the process is initiated by a positive number of particles and the moment when there are no individuals in the population for the first time.