Azure / Azure/bicep

Behavior of exported variables in file published to ACR is different to a local file.

Open
#16,256 5 comments 0 reactions 0 assignees View on GitHub
Quality Sprint
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Bicep version**
Bicep CLI version 0.33.93 (7a77c7f2a5)
Bicep VSCode version 0.33.93

**Describe the bug**
The behavior of a working bicep file with exported variables functions differently depending on if it sourced as a local file or in an ACR

**To Reproduce**
Steps to reproduce the behavior:

```bicep
// roles.bicep
@export()
var acrPull = {
id: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '7f951dda-4ed3-4680-a7ca-43fe172d538d')
name: 'AcrPull'
}
```

This works:
```bicep
// main.bicep
import { acrPull } from 'roles.bicep'
```

This does not work:
```bicep
// main.bicep
import { acrPull } from 'br/vars:roles:'

// The following error is shown:
// 'The 'acrPull' symbol was not found in (or was not exported by) the imported template. bicepBCP360'
```

**Additional context**
I would expect this to work as the contents of the file published to the ACR is the same as local 'roles.bicep' file which works.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the difference between the local roles.bicep import and the ACR reference in main.bicep using the reported Bicep CLI version. Trace how the published template exposes exported symbols, and consider the work complete when acrPull resolves identically from both sources with coverage for the ACR case.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.