Reputation: 57
I want to add around 50 keys and have thought of two approaches
P/S- I do not want to create keys using Azure portal.
Upvotes: 0
Views: 1280
Reputation: 5546
We have tested in our local environment, By creating the 50 keys in a csv file & tried adding them to key vault by using the below PowerShell script . It took around 3 minutes 06 seconds to complete script & to create 50 keys in key vault.
Here is the PowerShell script :
$Expires = (Get-Date).AddYears(2).ToUniversalTime()
$NotBefore = (Get-Date).ToUniversalTime()
Import-Csv C:\Users\Downloads\keys.csv|foreach{
Add-AzKeyVaultKey -VaultName '<keyvaultName>' -Name $_.Name -Destination 'Software' -Expires $Expires -NotBefore $NotBefore
}
Here is the screen shot for reference :
Here is reference Azure documentation for add-azkeyvaultkey
cmdlet to create a key using different parameters based on the requirement.
Upvotes: 1