Azure / Azure/bicep

scope() function to support multi-scope modules

Open
#10,131 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Is your feature request related to a problem? Please describe.**
Some resources support multiple scopes, like Cost Management budgets and scheduled actions. The modules for these features are identical, except for any specific handling around the scope. In some cases, we need specific logic based on the scope ID, but this requires different logic for each scope:

```bicep
// For subscriptions...
var scopeId = subscription().id
// For resource groups...
var scopeId = resourceGroup().id
// For management groups...
var scopeId = managementGroup().id
```

Since these functions all work differently for each scope, it's not possible to reuse the same code for each scoped module.

**Describe the solution you'd like**
Create a `scope()` function that is an alias for the scope the deployment is run for.

Contributor guide

Open the contributing guide

Research direction

The issue names no files, tests, or entry points. Start by locating the existing scope-related functions in the Bicep codebase and compare their deployment-scope behavior. Done means a scope() function can act as an alias for the deployment scope and support reuse across subscription, resource-group, and management-group modules.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.