Skip to content

config export does not preserve incoming metadata #668

Closed
@JohnMcPMS

Description

@JohnMcPMS

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest version
  • Search the existing issues.

Summary

When passing a configuration document to config export, the metadata in the original document is not in the output document.

Steps to reproduce

With this document:

# repro.yml
$schema: https://github.com/raw/PowerShell/DSC/main/schemas/2023/08/config/document.json
metadata:
  winget:
    processor: dscv3
resources:
  - name: OS
    type: Microsoft/OSInfo
    properties:
      $id: https://developer.microsoft.com/json-schemas/dsc/os_info/20230303/Microsoft.Dsc.OS_Info.schema.json

The result of dsc config export repro.yml is:

$schema: https://github.com/raw/PowerShell/DSC/main/schemas/2024/04/config/document.json
contentVersion: 1.0.0
resources:
- type: Microsoft/OSInfo
  name: Microsoft/OSInfo-0
  properties:
    $id: https://developer.microsoft.com/json-schemas/dsc/os_info/20230303/Microsoft.Dsc.OS_Info.schema.json
    family: Windows
    version: 10.0.23822
    edition: Windows 11 Enterprise
    bitness: '64'
    architecture: x86_64
metadata:
  Microsoft.DSC:
    version: 3.0.0
    operation: Export
    executionType: Actual
    startDatetime: 2025-03-05T09:10:15.418957600-08:00
    endDatetime: 2025-03-05T09:10:16.160492700-08:00
    duration: PT0.7415351S
    securityContext: Restricted

Expected behavior

Metadata properties *other* than `Microsoft.DSC` in the original document are in the resulting document.

Actual behavior

Only the `Microsoft.DSC` properties are in the output document.

Error details

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.0
PSEdition                      Core
GitCommitId                    7.5.0
OS                             Microsoft Windows 10.0.23822
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

3.0.0-rc.1

Visuals

No response

Metadata

Metadata

Assignees

Labels

Issue-BugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions