Azure / Azure/bicep

scope property in deployment() function

Open
#4,698 4 comments 0 reactions 0 assignees View on GitHub
enhancement intermediate language
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 2h
Merged PRs (30d)
79

Description

**Is your feature request related to a problem? Please describe.**
We have function like subscription() and soon to have managementGroup(). There are a few resources that allow to deployed at both subscription and management group scopes. The difference when these resources are deployed at these two scopes are minor. For example the main differences I have seen are:
- cannot deploy resource group at mg level
- policy definition and assignment names needs to be maximum 24 characters at management group level (at sub level it is higher number). No idea why this limit exists but it is there.
With that said if you want to create one bicep solution that can deploy the applicable resources to both scopes it is good that you can use managementGroup() or subscription() function depending on the scope the deployment happens.

**Describe the solution you'd like**
the solution would be something like:

```bicep
var someVar = deployment().scope =~ 'subscription' ? subscription().id : managementGroup().id
```

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing deployment(), subscription(), and managementGroup() function handling and their related tests. Determine how deployment scope is represented and validated, then define and test behavior for selecting the applicable scope so the example expression works at both subscription and management-group deployments.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.