Skip to content

Restore-KeyVaultKey

Azure: Restores a Key Vault key

param(
	[Parameter(Mandatory = $true)]
	[string]$VaultName,

	[Parameter(Mandatory = $true)]
	[string]$InputFile
)

try {
	Import-Module Az.KeyVault -ErrorAction Stop
	$key = Restore-AzKeyVaultKey -VaultName $VaultName -InputFile $InputFile -ErrorAction Stop
	Write-Output "Successfully restored key to vault '$VaultName'."
} catch {
	Write-Error $_
	exit 1
}

The name of the Key Vault.

The path to the backup file to restore.

An interactive directory of PowerShell scripts.