Is it possible to bind a variable to another variable and specific scope?

Given a variable named SubscriptionId, two environments Test and Prod, and distinct values assigned to SubscriptionId scoped at the environment level, is it possible to create a new variable called ProdSubscriptionId that binds to the Prod-environment-scoped SubscriptionId?

Something like (pseudo-syntax):

Name, Value, Scope (Environment)
SubscriptionId, “Test Subscription”, Test
SubscriptionId, "Prod Subscription, Prod
ProdSubscriptionId, #{SubscriptionId:Environment[Prod]}, null

Hi David,

Thanks for getting in touch! It won’t be possible to bind an environment-scoped variable to a variable that’s scoped to a different environment, as the difference in environment scope means it won’t be available during the deployment to the other environment. Perhaps you could create an unscoped SubscriptionId variable, and bind the environment-scoped variables to that (essentially in reverse)?

Let me know if I’ve misunderstood your question in any way, and we can try to think of an alternative solution to what you’re after. :slight_smile:

Best regards,

Kenny

Thanks for the response, Kenny. I figured it wouldn’t be possible. My posted example was a slightly simplified (and contrived) example to try to convey my question. I’ve worked around my issue in a different way but it’s less elegant than I would like. I still think it would be super cool to be able to bind a variable to another variable + scope.

Hi David,

You’re quite welcome! Great to hear you’ve managed to get a work around! Please don’t hesitate to reach out if you have any questions or concerns in the future. :slight_smile:

Best regards,

Kenny