get Secret
Use this data source to access information about an existing Key Vault Secret.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.keyvault.getSecret({
name: "secret-sauce",
keyVaultId: existing.id,
});
export const secretValue = example.then(example => example.value);
import pulumi
import pulumi_azure as azure
example = azure.keyvault.get_secret(name="secret-sauce",
key_vault_id=existing["id"])
pulumi.export("secretValue", example.value)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = Azure.KeyVault.GetSecret.Invoke(new()
{
Name = "secret-sauce",
KeyVaultId = existing.Id,
});
return new Dictionary<string, object?>
{
["secretValue"] = example.Apply(getSecretResult => getSecretResult.Value),
};
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/keyvault"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := keyvault.LookupSecret(ctx, &keyvault.LookupSecretArgs{
Name: "secret-sauce",
KeyVaultId: existing.Id,
}, nil)
if err != nil {
return err
}
ctx.Export("secretValue", example.Value)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.keyvault.KeyvaultFunctions;
import com.pulumi.azure.keyvault.inputs.GetSecretArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = KeyvaultFunctions.getSecret(GetSecretArgs.builder()
.name("secret-sauce")
.keyVaultId(existing.id())
.build());
ctx.export("secretValue", example.value());
}
}
variables:
example:
fn::invoke:
function: azure:keyvault:getSecret
arguments:
name: secret-sauce
keyVaultId: ${existing.id}
outputs:
secretValue: ${example.value}
Return
A collection of values returned by getSecret.
Parameters
A collection of arguments for invoking getSecret.
Return
A collection of values returned by getSecret.
Parameters
Specifies the ID of the Key Vault instance to fetch secret names from, available on the azure.keyvault.KeyVault
Data Source / Resource.
Specifies the name of the Key Vault Secret.
Specifies the version of the Key Vault Secret. Defaults to the current version of the Key Vault Secret.
Note: The vault must be in the same subscription as the provider. If the vault is in another subscription, you must create an aliased provider for that subscription.
See also
Return
A collection of values returned by getSecret.
Parameters
Builder for com.pulumi.azure.keyvault.kotlin.inputs.GetSecretPlainArgs.