Stack Issue

Bring back removed code from TestEnvironment for Search #2571

Project azure-sdk-for-net