Skip to content

Add outputs support in configuration #1010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

SteveL-MSFT
Copy link
Member

PR Summary

Currently blocked on Azure/bicep#17670 where bicep is crashing when trying to format the resourceId

Add support to use outputs section of configuration to have custom output as part of the result. This is needed to use DSC bicep files as modules.

PR Context

Part of #976

@Gijsreyn
Copy link
Contributor

Gijsreyn commented Aug 15, 2025

Hey @SteveL-MSFT,

In an attempt to fix and test this out locally, I stumbled on a few issues. With the change added to the Bicep CLI at: Azure/bicep#17805, the produced JSON looks like:

{
  "$schema": "https://aka.ms/dsc/schemas/v3/bundled/config/document.json",
  "contentVersion": "1.0.0.0",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.37.52.64608",
      "templateHash": "928342520835393415"
    }
  },
  "resources": [
    {
      "type": "Microsoft.DSC.Debug/Echo",
      "apiVersion": "2025-01-01",
      "name": "exampleEcho",
      "properties": {
        "output": "Hello, world!"
      }
    }
  ],
  "outputs": {
    "exampleOutput": {
      "type": "string",
      "value": "[reference(concat('Microsoft.DSC.Debug/Echo', '/', 'exampleEcho'), '2025-01-01').output]"
    }
  }
}

When I'm running that through your branch, another error pops up: Error: JSON: unknown field value, expected one of condition, type, value_or_copy at line 1 column 392

Looking at the docs, I would say that in the output object, it can be a value or a copy, not what the current implementation has. If I'm running it like this:

"outputs": {
    "exampleOutput": {
      "type": "string",
      "value_or_copy": {
        "value": "[reference(concat('Microsoft.DSC.Debug/Echo', '/', 'exampleEcho'), '2025-01-01').output]"
      }
    }
  }

It at least proceeds further, but comes with the following error message: Parser: Function 'reference' requires exactly 1 arguments. I've seen some changes with that particular apiVersion at the end. However, I cannot say much about it with my current knowledge.

Nevertheless, one more time try with "value": "[reference(concat('Microsoft.DSC.Debug/Echo', '/', 'exampleEcho')).output]" specified, gives me: Parser: Invalid resourceId or resource has not executed yet: Microsoft.DSC.Debug/Echo/exampleEcho. This is probably still a WIP.

I wanted to share this to see if improvements can be made at the Bicep side or DSC. Hope it helps further in the development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants