Azure / Azure/bicep

Using custom functions through desiredStateConfiguration targetScope does not work

Open
#17,762 1 comment 1 reaction 0 assignees View on GitHub
DSC V3
Dominant language
Bicep
Stars
3.6k
Forks
830
Avg merge
1d 21m
Merged PRs (30d)
79

Description

**Bicep version**
Bicep CLI version 0.37.4 (27cc8db2ed)

**Describe the bug**
Microsoft DSC v3 implements its own custom functions. For example, to determine the current drive, I could define the following:

```bicep
targetScope = 'desiredStateConfiguration'

resource powerShellAdapter 'PSDesiredStateConfiguration/File@2025-01-07' = {
name: 'Use Bicep to create file'
properties: {
Ensure: 'Present'
Type: 'File'
DestinationPath: '${systemroot()}\\DSC\\config.txt'
Contents: 'This file was created using Bicep extension from DSC.'
}
}
```

Trying to compile this, results in an error:

Image

**To Reproduce**
Grab the example from the [pull request](https://github.com/PowerShell/DSC/pull/806/files) and run `bicep build file_with_condition.dsc.bicep`

**Additional context**
Add any other context about the problem here.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the referenced file_with_condition.dsc.bicep and the command bicep build file_with_condition.dsc.bicep. Trace how the compiler handles desiredStateConfiguration targetScope and the systemroot() custom function; done means the example compiles successfully with the expected function call preserved.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.