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 LookupSecret in the Go SDK.

public static class GetSecret {
    public static Task<GetSecretResult> InvokeAsync(GetSecretArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

KeyVaultId string

Specifies the ID of the Key Vault instance where the Secret resides, available on the azure.keyvault.KeyVault Data Source / Resource.

Name string

Specifies the name of the Key Vault Secret.

KeyVaultId string

Specifies the ID of the Key Vault instance where the Secret resides, available on the azure.keyvault.KeyVault Data Source / Resource.

Name string

Specifies the name of the Key Vault Secret.

keyVaultId string

Specifies the ID of the Key Vault instance where the Secret resides, available on the azure.keyvault.KeyVault Data Source / Resource.

name string

Specifies the name of the Key Vault Secret.

key_vault_id str

Specifies the ID of the Key Vault instance where the Secret resides, available on the azure.keyvault.KeyVault Data Source / Resource.

name str

Specifies the name of the Key Vault Secret.

GetSecret Result

The following output properties are available:

ContentType string

The content type for the Key Vault Secret.

Id string

The provider-assigned unique ID for this managed resource.

KeyVaultId string
Name string
Tags 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.

ContentType string

The content type for the Key Vault Secret.

Id string

The provider-assigned unique ID for this managed resource.

KeyVaultId string
Name string
Tags 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.

contentType string

The content type for the Key Vault Secret.

id string

The provider-assigned unique ID for this managed resource.

keyVaultId string
name string
tags {[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.

content_type str

The content type for the Key Vault Secret.

id str

The provider-assigned unique ID for this managed resource.

key_vault_id str
name str
tags Dict[str, str]

Any tags assigned to this resource.

value str

The value of the Key Vault Secret.

version str

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 azurerm Terraform Provider.