Default value for variable

It seems like someone would have asked this before, but I can’t find it in the list of questions, and I can’t think of any intuitive way to do it with the available options (unless because of the rules of variable precedence this just works. :slight_smile: ). In which case, this question can maybe point back to those. I realize some of this may be reduced with multi-tenant changes, but I still expect this to present itself.

So let me ask my question and then suggest a couple of scenarios where I seem to get bitten on this.
Is there a way to set a default value for variables for all roles/environments unless specifically stated otherwise?

Example: We have variable substitution set up for logging. In dev, we went more debugging turned on by default, however because it isn’t an app setting, we have it set in the web.config to be a substitution variable. Then in our variables we have

key: logFilter, value: Error, Scope: Production (US), Production (EU), Disaster Recovery, Staging (US)… etc.
key: logFilter, value: Debug, Scope: Dev

So dev is the only place where I want the different value. Everywhere else, including (by default) onboarded environments should have “Error”. The onboarding is the thing that is dangerous right now because it is very easy to miss adding the scope to every variable (ignoring the fact that it’s a pain to go through all the different projects.)

Then there have been occasions where we’ve had a value set to something (say port 443 for where the site exists). I have it as a value, but now because some environment wants it set to 444 I not only have to add scope to the new value, but I have to go back and make sure not to miss any scope on the previously existing variable.

We solve this by defining defaults for deployment variables either in deployment scripts (preferred), or in variables library.

Right, but I’m asking how to set a default. If I have

Key: logFilter, Value: Error, Scope: N\A (not specified)
Key: logFilter, Value: Debug, Scope: Dev

Do I not have to worry about the no scope creeping in on the dev one and being favored?

(This might be how the order of precendence works)


Scoped variables always have higher priority than non-scoped. Moreover, the more scoped variable is, the higher its priority is. Thus, variable scoped by env only have lower priority than variable scoped by environment AND target.

Hi Mike and Dmitry,

Thanks for reaching out! Dmitry is correct with the priority of scoped variables. A variable scoped to an environment (Dev), will always have precedence over an unscoped variable. And having no scope is the way to define a default value.

Variable scoping can potentially get quite complicated. We have some good documentation on Scope Specificity, which outlines our defined hierarchy. There’s also a great blog post which goes very in depth with this topic if you’d like to read more!

Feel free to reach out with any further questions,



This issue has been closed due to inactivity. If you encounter the same or a similar issue and require help, please open a new discussion (if we asked for logs or extra details in this thread, consider including them in the new thread). If you are the creator of this thread and believe it should not be closed let us know via our support email.