Skip to main content

Set-KeldorSecret

SYNOPSIS

Sets a Keldor secret.

SYNTAX

Set-KeldorSecret [-Name] <String> [-Secret] <Object> [[-Vault] <String>] [-Provider <String>] [-Field <String>]
[-Force] [-PassThru] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Sets a secret using a single writable Keldor secret provider. Auto provider selection chooses one provider in priority order and does not fall back after a write attempt.

EXAMPLES

EXAMPLE 1

Set-KeldorSecret -Name GitHubToken -Secret $Token -Provider SecretManagement -Vault DevOps -Force

Stores the GitHubToken secret in the DevOps SecretManagement vault.

EXAMPLE 2

Set-KDSecret -Name 'GitHub Token' -Secret $Token -Provider Environment -PassThru

Sets the process-scoped KELDOR_SECRET_GITHUB_TOKEN environment variable by using the Set-KDSecret alias.

PARAMETERS

-Name

Specifies the secret or provider item name.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Secret

Specifies the secret value as a string or SecureString.

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Vault

Specifies the optional provider vault or container name.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Provider

Specifies the secret provider to use. Auto selects one writable provider in priority order.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: Auto
Accept pipeline input: False
Accept wildcard characters: False

-Field

Specifies a provider field to update. Only providers that support named fields accept this parameter.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Force

Replaces an existing secret when the provider supports existence checks.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

Returns a non-sensitive result object describing the operation.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

None. Returns Keldor.SecretWriteResult when PassThru is specified.

NOTES

Alias: Set-KDSecret Environment provider values are process scoped and disappear when the process exits.

ALIASES

Set-KDSecret

PLATFORM APPLICABILITY

Windows, macOS, and Linux.

POWERSHELL COMPATIBILITY

See PowerShell compatibility for the supported runtime policy. PowerShell 7.6 LTS is preferred.

https://docs.keldor.dev/powershell/keldor/Set-KeldorSecret