get Key
Use this data source to access information about an existing Key Vault Key.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.keyvault.getKey({
name: "secret-sauce",
keyVaultId: existing.id,
});
export const keyType = example.then(example => example.keyType);
Content copied to clipboard
import pulumi
import pulumi_azure as azure
example = azure.keyvault.get_key(name="secret-sauce",
key_vault_id=existing["id"])
pulumi.export("keyType", example.key_type)
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = Azure.KeyVault.GetKey.Invoke(new()
{
Name = "secret-sauce",
KeyVaultId = existing.Id,
});
return new Dictionary<string, object?>
{
["keyType"] = example.Apply(getKeyResult => getKeyResult.KeyType),
};
});
Content copied to clipboard
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.LookupKey(ctx, &keyvault.LookupKeyArgs{
Name: "secret-sauce",
KeyVaultId: existing.Id,
}, nil)
if err != nil {
return err
}
ctx.Export("keyType", example.KeyType)
return nil
})
}
Content copied to clipboard
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.GetKeyArgs;
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.getKey(GetKeyArgs.builder()
.name("secret-sauce")
.keyVaultId(existing.id())
.build());
ctx.export("keyType", example.keyType());
}
}
Content copied to clipboard
variables:
example:
fn::invoke:
function: azure:keyvault:getKey
arguments:
name: secret-sauce
keyVaultId: ${existing.id}
outputs:
keyType: ${example.keyType}
Content copied to clipboard
Return
A collection of values returned by getKey.
Parameters
argument
A collection of arguments for invoking getKey.
Return
A collection of values returned by getKey.
Parameters
key Vault Id
Specifies the ID of the Key Vault instance where the Secret resides, available on the azure.keyvault.KeyVault
Data Source / Resource.
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.
name
Specifies the name of the Key Vault Key.
See also
Return
A collection of values returned by getKey.
Parameters
argument
Builder for com.pulumi.azure.keyvault.kotlin.inputs.GetKeyPlainArgs.