Add-KeyVaultKey
Azure: Adds a key to a Key Vault
param(
[Parameter(Mandatory = $true)]
[string]$VaultName,
[Parameter(Mandatory = $true)]
[string]$Name,
[Parameter(Mandatory = $false)]
[ValidateSet('Software', 'HSM')]
[string]$Destination = 'Software'
)
try {
Import-Module Az.KeyVault -ErrorAction Stop
Add-AzKeyVaultKey -VaultName $VaultName -Name $Name -Destination $Destination -ErrorAction Stop
Write-Output "Successfully added key '$Name' to vault '$VaultName'."
} catch {
Write-Error $_
exit 1
}The name of the Key Vault.
The name of the key to create.
The destination of the key (Software or HSM).