1. Packages
  2. Azure Classic
  3. API Docs
  4. keyvault
  5. getManagedHardwareSecurityModuleKey

We recommend using Azure Native.

Azure v6.22.0 published on Tuesday, Apr 1, 2025 by Pulumi

azure.keyvault.getManagedHardwareSecurityModuleKey

Explore with Pulumi AI

Use this data source to access information about an existing Managed Hardware Security Module Key.

Note: All arguments including the secret value will be stored in the raw state as plain-text. Read more about sensitive data in state.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

export = async () => {
    const example = await azure.keyvault.getManagedHardwareSecurityModuleKey({
        managedHsmId: exampleAzurermKeyVaultManagedHardwareSecurityModule.id,
        name: exampleAzurermKeyVaultManagedHardwareSecurityModuleKey.name,
    });
    return {
        "hsm-key-vesrion": example.version,
    };
}
Copy
import pulumi
import pulumi_azure as azure

example = azure.keyvault.get_managed_hardware_security_module_key(managed_hsm_id=example_azurerm_key_vault_managed_hardware_security_module["id"],
    name=example_azurerm_key_vault_managed_hardware_security_module_key["name"])
pulumi.export("hsm-key-vesrion", example.version)
Copy
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.LookupManagedHardwareSecurityModuleKey(ctx, &keyvault.LookupManagedHardwareSecurityModuleKeyArgs{
			ManagedHsmId: exampleAzurermKeyVaultManagedHardwareSecurityModule.Id,
			Name:         exampleAzurermKeyVaultManagedHardwareSecurityModuleKey.Name,
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("hsm-key-vesrion", example.Version)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var example = Azure.KeyVault.GetManagedHardwareSecurityModuleKey.Invoke(new()
    {
        ManagedHsmId = exampleAzurermKeyVaultManagedHardwareSecurityModule.Id,
        Name = exampleAzurermKeyVaultManagedHardwareSecurityModuleKey.Name,
    });

    return new Dictionary<string, object?>
    {
        ["hsm-key-vesrion"] = example.Apply(getManagedHardwareSecurityModuleKeyResult => getManagedHardwareSecurityModuleKeyResult.Version),
    };
});
Copy
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.GetManagedHardwareSecurityModuleKeyArgs;
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.getManagedHardwareSecurityModuleKey(GetManagedHardwareSecurityModuleKeyArgs.builder()
            .managedHsmId(exampleAzurermKeyVaultManagedHardwareSecurityModule.id())
            .name(exampleAzurermKeyVaultManagedHardwareSecurityModuleKey.name())
            .build());

        ctx.export("hsm-key-vesrion", example.applyValue(getManagedHardwareSecurityModuleKeyResult -> getManagedHardwareSecurityModuleKeyResult.version()));
    }
}
Copy
variables:
  example:
    fn::invoke:
      function: azure:keyvault:getManagedHardwareSecurityModuleKey
      arguments:
        managedHsmId: ${exampleAzurermKeyVaultManagedHardwareSecurityModule.id}
        name: ${exampleAzurermKeyVaultManagedHardwareSecurityModuleKey.name}
outputs:
  hsm-key-vesrion: ${example.version}
Copy

Using getManagedHardwareSecurityModuleKey

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getManagedHardwareSecurityModuleKey(args: GetManagedHardwareSecurityModuleKeyArgs, opts?: InvokeOptions): Promise<GetManagedHardwareSecurityModuleKeyResult>
function getManagedHardwareSecurityModuleKeyOutput(args: GetManagedHardwareSecurityModuleKeyOutputArgs, opts?: InvokeOptions): Output<GetManagedHardwareSecurityModuleKeyResult>
Copy
def get_managed_hardware_security_module_key(managed_hsm_id: Optional[str] = None,
                                             name: Optional[str] = None,
                                             opts: Optional[InvokeOptions] = None) -> GetManagedHardwareSecurityModuleKeyResult
def get_managed_hardware_security_module_key_output(managed_hsm_id: Optional[pulumi.Input[str]] = None,
                                             name: Optional[pulumi.Input[str]] = None,
                                             opts: Optional[InvokeOptions] = None) -> Output[GetManagedHardwareSecurityModuleKeyResult]
Copy
func LookupManagedHardwareSecurityModuleKey(ctx *Context, args *LookupManagedHardwareSecurityModuleKeyArgs, opts ...InvokeOption) (*LookupManagedHardwareSecurityModuleKeyResult, error)
func LookupManagedHardwareSecurityModuleKeyOutput(ctx *Context, args *LookupManagedHardwareSecurityModuleKeyOutputArgs, opts ...InvokeOption) LookupManagedHardwareSecurityModuleKeyResultOutput
Copy

> Note: This function is named LookupManagedHardwareSecurityModuleKey in the Go SDK.

public static class GetManagedHardwareSecurityModuleKey 
{
    public static Task<GetManagedHardwareSecurityModuleKeyResult> InvokeAsync(GetManagedHardwareSecurityModuleKeyArgs args, InvokeOptions? opts = null)
    public static Output<GetManagedHardwareSecurityModuleKeyResult> Invoke(GetManagedHardwareSecurityModuleKeyInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetManagedHardwareSecurityModuleKeyResult> getManagedHardwareSecurityModuleKey(GetManagedHardwareSecurityModuleKeyArgs args, InvokeOptions options)
public static Output<GetManagedHardwareSecurityModuleKeyResult> getManagedHardwareSecurityModuleKey(GetManagedHardwareSecurityModuleKeyArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: azure:keyvault/getManagedHardwareSecurityModuleKey:getManagedHardwareSecurityModuleKey
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

ManagedHsmId
This property is required.
Changes to this property will trigger replacement.
string

Specifies the ID of the Managed Hardware Security Module instance where the Secret resides, available on the azure.keyvault.ManagedHardwareSecurityModuleKey Data Source / Resource.

NOTE: The Managed Hardware Security Module must be in the same subscription as the provider. If the Managed Hardware Security Module is in another subscription, you must create an aliased provider for that subscription.

Name
This property is required.
Changes to this property will trigger replacement.
string
Specifies the name of the Managed Hardware Security Module Key.
ManagedHsmId
This property is required.
Changes to this property will trigger replacement.
string

Specifies the ID of the Managed Hardware Security Module instance where the Secret resides, available on the azure.keyvault.ManagedHardwareSecurityModuleKey Data Source / Resource.

NOTE: The Managed Hardware Security Module must be in the same subscription as the provider. If the Managed Hardware Security Module is in another subscription, you must create an aliased provider for that subscription.

Name
This property is required.
Changes to this property will trigger replacement.
string
Specifies the name of the Managed Hardware Security Module Key.
managedHsmId
This property is required.
Changes to this property will trigger replacement.
String

Specifies the ID of the Managed Hardware Security Module instance where the Secret resides, available on the azure.keyvault.ManagedHardwareSecurityModuleKey Data Source / Resource.

NOTE: The Managed Hardware Security Module must be in the same subscription as the provider. If the Managed Hardware Security Module is in another subscription, you must create an aliased provider for that subscription.

name
This property is required.
Changes to this property will trigger replacement.
String
Specifies the name of the Managed Hardware Security Module Key.
managedHsmId
This property is required.
Changes to this property will trigger replacement.
string

Specifies the ID of the Managed Hardware Security Module instance where the Secret resides, available on the azure.keyvault.ManagedHardwareSecurityModuleKey Data Source / Resource.

NOTE: The Managed Hardware Security Module must be in the same subscription as the provider. If the Managed Hardware Security Module is in another subscription, you must create an aliased provider for that subscription.

name
This property is required.
Changes to this property will trigger replacement.
string
Specifies the name of the Managed Hardware Security Module Key.
managed_hsm_id
This property is required.
Changes to this property will trigger replacement.
str

Specifies the ID of the Managed Hardware Security Module instance where the Secret resides, available on the azure.keyvault.ManagedHardwareSecurityModuleKey Data Source / Resource.

NOTE: The Managed Hardware Security Module must be in the same subscription as the provider. If the Managed Hardware Security Module is in another subscription, you must create an aliased provider for that subscription.

name
This property is required.
Changes to this property will trigger replacement.
str
Specifies the name of the Managed Hardware Security Module Key.
managedHsmId
This property is required.
Changes to this property will trigger replacement.
String

Specifies the ID of the Managed Hardware Security Module instance where the Secret resides, available on the azure.keyvault.ManagedHardwareSecurityModuleKey Data Source / Resource.

NOTE: The Managed Hardware Security Module must be in the same subscription as the provider. If the Managed Hardware Security Module is in another subscription, you must create an aliased provider for that subscription.

name
This property is required.
Changes to this property will trigger replacement.
String
Specifies the name of the Managed Hardware Security Module Key.

getManagedHardwareSecurityModuleKey Result

The following output properties are available:

Curve string
The EC Curve name of this Managed Hardware Security Module Key.
ExpirationDate string
Id string
The provider-assigned unique ID for this managed resource.
KeyOpts List<string>
A list of JSON web key operations assigned to this Managed Hardware Security Module Key
KeySize int
Specifies the Size of this Managed Hardware Security Module Key.
KeyType string
Specifies the Key Type of this Managed Hardware Security Module Key
ManagedHsmId string
Name string
NotBeforeDate string
Tags Dictionary<string, string>
A mapping of tags assigned to this Managed Hardware Security Module Key.
Version string
The current version of the Managed Hardware Security Module Key.
VersionedId string
The versioned ID of the Managed Hardware Security Module Key.
Curve string
The EC Curve name of this Managed Hardware Security Module Key.
ExpirationDate string
Id string
The provider-assigned unique ID for this managed resource.
KeyOpts []string
A list of JSON web key operations assigned to this Managed Hardware Security Module Key
KeySize int
Specifies the Size of this Managed Hardware Security Module Key.
KeyType string
Specifies the Key Type of this Managed Hardware Security Module Key
ManagedHsmId string
Name string
NotBeforeDate string
Tags map[string]string
A mapping of tags assigned to this Managed Hardware Security Module Key.
Version string
The current version of the Managed Hardware Security Module Key.
VersionedId string
The versioned ID of the Managed Hardware Security Module Key.
curve String
The EC Curve name of this Managed Hardware Security Module Key.
expirationDate String
id String
The provider-assigned unique ID for this managed resource.
keyOpts List<String>
A list of JSON web key operations assigned to this Managed Hardware Security Module Key
keySize Integer
Specifies the Size of this Managed Hardware Security Module Key.
keyType String
Specifies the Key Type of this Managed Hardware Security Module Key
managedHsmId String
name String
notBeforeDate String
tags Map<String,String>
A mapping of tags assigned to this Managed Hardware Security Module Key.
version String
The current version of the Managed Hardware Security Module Key.
versionedId String
The versioned ID of the Managed Hardware Security Module Key.
curve string
The EC Curve name of this Managed Hardware Security Module Key.
expirationDate string
id string
The provider-assigned unique ID for this managed resource.
keyOpts string[]
A list of JSON web key operations assigned to this Managed Hardware Security Module Key
keySize number
Specifies the Size of this Managed Hardware Security Module Key.
keyType string
Specifies the Key Type of this Managed Hardware Security Module Key
managedHsmId string
name string
notBeforeDate string
tags {[key: string]: string}
A mapping of tags assigned to this Managed Hardware Security Module Key.
version string
The current version of the Managed Hardware Security Module Key.
versionedId string
The versioned ID of the Managed Hardware Security Module Key.
curve str
The EC Curve name of this Managed Hardware Security Module Key.
expiration_date str
id str
The provider-assigned unique ID for this managed resource.
key_opts Sequence[str]
A list of JSON web key operations assigned to this Managed Hardware Security Module Key
key_size int
Specifies the Size of this Managed Hardware Security Module Key.
key_type str
Specifies the Key Type of this Managed Hardware Security Module Key
managed_hsm_id str
name str
not_before_date str
tags Mapping[str, str]
A mapping of tags assigned to this Managed Hardware Security Module Key.
version str
The current version of the Managed Hardware Security Module Key.
versioned_id str
The versioned ID of the Managed Hardware Security Module Key.
curve String
The EC Curve name of this Managed Hardware Security Module Key.
expirationDate String
id String
The provider-assigned unique ID for this managed resource.
keyOpts List<String>
A list of JSON web key operations assigned to this Managed Hardware Security Module Key
keySize Number
Specifies the Size of this Managed Hardware Security Module Key.
keyType String
Specifies the Key Type of this Managed Hardware Security Module Key
managedHsmId String
name String
notBeforeDate String
tags Map<String>
A mapping of tags assigned to this Managed Hardware Security Module Key.
version String
The current version of the Managed Hardware Security Module Key.
versionedId String
The versioned ID of the Managed Hardware Security Module Key.

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.