Change secret extensions to emit secret without JSON wrapping#1046
Merged
SteveL-MSFT merged 5 commits intoPowerShell:mainfrom Aug 13, 2025
Merged
Change secret extensions to emit secret without JSON wrapping#1046SteveL-MSFT merged 5 commits intoPowerShell:mainfrom
SteveL-MSFT merged 5 commits intoPowerShell:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR changes secret extensions to emit secrets directly as plaintext to STDOUT instead of being wrapped in JSON format. This simplifies the secret handling workflow and eliminates unnecessary serialization/deserialization steps.
- Removes JSON wrapping from secret extension output, requiring all secret extensions to emit plaintext directly
- Fixes schema references in extension manifests to use the correct extension schema instead of resource schema
- Updates test secret extensions to output plaintext instead of JSON-wrapped objects
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| extensions/test/secret/testSecret2.dsc.extension.json | Updates schema reference and description to reflect extension usage |
| extensions/test/secret/testSecret.dsc.extension.json | Updates schema reference and description to reflect extension usage |
| extensions/test/secret/secret.ps1 | Removes JSON wrapping and outputs secret directly |
| extensions/bicep/bicep.dsc.extension.json | Fixes schema reference to use extension manifest schema |
| dsc_lib/src/extensions/secret.rs | Removes SecretResult struct as JSON wrapping is no longer needed |
| dsc_lib/src/extensions/dscextension.rs | Updates secret handling to process plaintext output directly and reformats use statements |
6ae8391 to
f80a0b0
Compare
718a52f to
59a0aa0
Compare
tgauth
approved these changes
Aug 13, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
While working with AzCLI team to produce secret extension, it became obvious that the extension should just emit the secret as-is to STDOUT without being wrapped in JSON as it provides no value and just needs to be deserialized. In the future, if there are properties to the secret, we can add a schema and add to SecretMethod definition to have something like
kindto indicate the type of output expected. However, with this change ALL secret extensions MUST emit just the secret as plaintext to STDOUT with trailing newline. Multiple lines to STDOUT is an error.While fixing that, I also noticed that the
$schemafor some extensions was using the resource schema instead of the extension schema, so fixed those as well. Also reformatted theusestatement to make it more readable.Manually tested with prototype azcli extension manifest:
{ "$schema": "https://aka.ms/dsc/schemas/v3/bundled/extension/manifest.json", "type": "Microsoft.Azure.CLI/KeyVault", "version": "1.0.0", "description": "Retrieve secrets from Azure KeyVault", "secret": { "executable": "az.cmd", "args": [ "keyvault", "secret", "show", { "vaultArg": "--vault-name" }, { "nameArg": "--name" }, "--query", "value", "--output", "tsv" ] } }