Created
May 31, 2022 15:25
-
-
Save spawnrider/c1c3c134d261d9678beeed793956dcfc to your computer and use it in GitHub Desktop.
Copying an Azure Key Vault using Powershell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param( | |
[Parameter(Mandatory)] | |
[string]$sourceKvName, | |
[Parameter(Mandatory)] | |
[string]$destKvName | |
) | |
Connect-AzAccount | |
$secretNames = (Get-AzKeyVaultSecret -VaultName $sourceKvName).Name | |
$secretNames.foreach{ | |
Set-AzKeyVaultSecret -VaultName $destKvName -Name $_ ` | |
-SecretValue (Get-AzKeyVaultSecret -VaultName $sourceKvName -Name $_).SecretValue | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment