We consider a general storage system with applications to energy systems. Energy inflow, energy demand and costs interact with an environmental process. In each period, a limited amount of energy can be purchased from a supplementary source of energy at a cost per unit lower than a penalty cost for unmet demand. Sufficient conditions are found for the optimality of a zone-based release rule with critical numbers depending on the current state of the environment. There one buffer is needed to build up a storage level in the usual sense and a second one to protect against possible losses due to the variability in the randomly varying costs for unmet demand. The great versatility of our model is shown within the context of reservoir, hybrid energy and natural gas storage systems.