Change secret extensions to emit secret without JSON wrapping #1046
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" ] } }