GetSecret
Use this data source to access information about an existing Key Vault Secret.
Example Usage
using Pulumi;
using Azure = Pulumi.Azure;
class MyStack : Stack
{
public MyStack()
{
var example = Output.Create(Azure.KeyVault.GetSecret.InvokeAsync(new Azure.KeyVault.GetSecretArgs
{
Name = "secret-sauce",
KeyVaultId = data.Azurerm_key_vault.Existing.Id,
}));
this.SecretValue = example.Apply(example => example.Value);
}
[Output("secretValue")]
public Output<string> SecretValue { get; set; }
}
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v3/go/azure/keyvault"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := keyvault.LookupSecret(ctx, &keyvault.LookupSecretArgs{
Name: "secret-sauce",
KeyVaultId: data.Azurerm_key_vault.Existing.Id,
}, nil)
if err != nil {
return err
}
ctx.Export("secretValue", example.Value)
return nil
})
}import pulumi
import pulumi_azure as azure
example = azure.keyvault.get_secret(name="secret-sauce",
key_vault_id=data["azurerm_key_vault"]["existing"]["id"])
pulumi.export("secretValue", example.value)import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.keyvault.getSecret({
name: "secret-sauce",
keyVaultId: data.azurerm_key_vault.existing.id,
});
export const secretValue = example.then(example => example.value);Using GetSecret
function getSecret(args: GetSecretArgs, opts?: InvokeOptions): Promise<GetSecretResult>function get_secret(key_vault_id=None, name=None, opts=None)func LookupSecret(ctx *Context, args *LookupSecretArgs, opts ...InvokeOption) (*LookupSecretResult, error)Note: This function is named
LookupSecretin the Go SDK.
public static class GetSecret {
public static Task<GetSecretResult> InvokeAsync(GetSecretArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
- Key
Vault stringId Specifies the ID of the Key Vault instance where the Secret resides, available on the
azure.keyvault.KeyVaultData Source / Resource.- Name string
Specifies the name of the Key Vault Secret.
- Key
Vault stringId Specifies the ID of the Key Vault instance where the Secret resides, available on the
azure.keyvault.KeyVaultData Source / Resource.- Name string
Specifies the name of the Key Vault Secret.
- key
Vault stringId Specifies the ID of the Key Vault instance where the Secret resides, available on the
azure.keyvault.KeyVaultData Source / Resource.- name string
Specifies the name of the Key Vault Secret.
- key_
vault_ strid Specifies the ID of the Key Vault instance where the Secret resides, available on the
azure.keyvault.KeyVaultData Source / Resource.- name str
Specifies the name of the Key Vault Secret.
GetSecret Result
The following output properties are available:
- Content
Type string The content type for the Key Vault Secret.
- Id string
The provider-assigned unique ID for this managed resource.
- Key
Vault stringId - Name string
- Dictionary<string, string>
Any tags assigned to this resource.
- Value string
The value of the Key Vault Secret.
- Version string
The current version of the Key Vault Secret.
- Content
Type string The content type for the Key Vault Secret.
- Id string
The provider-assigned unique ID for this managed resource.
- Key
Vault stringId - Name string
- map[string]string
Any tags assigned to this resource.
- Value string
The value of the Key Vault Secret.
- Version string
The current version of the Key Vault Secret.
- content
Type string The content type for the Key Vault Secret.
- id string
The provider-assigned unique ID for this managed resource.
- key
Vault stringId - name string
- {[key: string]: string}
Any tags assigned to this resource.
- value string
The value of the Key Vault Secret.
- version string
The current version of the Key Vault Secret.
Package Details
- Repository
- https://github.com/pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.