Azure Staging environment infrastructure - can i put it on hold?

8/15/2019

in Azure i have two subscriptions, 1 for Produciton, 1 for Staging. the staging environment is an exact replica of staging and is used in our development pipeline. however we don't use it all the time.

is anybody aware of a way to "shut down" or "put on hold" azure infrastructure in a staging subscription and then re-activate it when we want to use it?

simply an approach to keep costs down on an occasional use environment?

both prod and staging are up and running, not sure how to "suspend" staging

-- TunedBy
azure
infrastructure
kubernetes

1 Answer

8/15/2019

So there are a few options available.

  1. You can script your infrastructure with Azure ARM templates. You can then run an ARM project from Visual Studio before you begin testing, which will provision all of the resources that you need in your staging environment. When your testers are done, just delete the staging Azure resource groups containing the assets. Presto! - you only pay for the time your infrastructure is active.

  2. As a twist on #1, create an Azure Pipeline that deploys both your ARM project and your code. This is the fastest way to get going on your testing environment.

  3. You can create a script to execute in Powershell or the Azure CLI that will spin your resources down to the free or minimum billing SKUs, then another script to spin them up to your required SKUs. I have never actually performed this option, but have read about it.

I recommend using Azure ARM templates to script your resources. Done well, you can swap out parameter files containing variables so that you can use the same template for your staging and production environments. Be VERY SURE you understand how Azure will handle reconciling what's in the ARM template with resources in your resource group before you unleash this on a production environment; things can get deleted or modified if you are careless with what your'e doing.

-- Rob Reagan
Source: StackOverflow