Azure密钥保管库:使用PowerShell的备份机密 [英] Azure Key Vault: Backup Secrets using PowerShell
本文介绍了Azure密钥保管库:使用PowerShell的备份机密的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试运行以下PS脚本来备份特定Azure密钥保管库中的所有机密:
I am trying to run the following PS script to back-up all of the Secrets, in a specific Azure Key Vault:
$secret = Get-AzureKeyVaultSecret –VaultName 'testkeyvault-1' |
ForEach-Object {
$Name = $_."Name"
Backup-AzureKeyVaultSecret -Secret $Name -OutputFile 'C:\Backup.blob'
}
尽管由于以下PS错误而失败,但我们将不胜感激:
Though this is failing with the following PS error, any help would be appreciated:
Backup-AzureKeyVaultSecret : Cannot bind parameter 'Secret'. Cannot convert the "SQLSecret" value of type "System.String" to type "Microsoft.Azure.Commands.KeyVault.Models.Secret".
At line:4 char:36
+ Backup-AzureKeyVaultSecret -Secret $Name -OutputFile 'C:\Backup.blob'
+ ~~~~~
+ CategoryInfo : InvalidArgument: (:) [Backup- AzureKeyVaultSecret], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Azure.Commands.KeyVault.BackupAzureKeyVaultSecret
推荐答案
尝试一下:
[string]$VaultName = 'testkeyvault-1'
Get-AzureKeyVaultSecret –VaultName $VaultName |
ForEach-Object {
Backup-AzureKeyVaultSecret `
–VaultName $VaultName `
-Name $_."Name" `
-OutputFile ('C:\Backup_{0}.blob' -f $_."Name")
}
相关文档:
- Get-AzureKeyVaultSecret
- Backup-AzureKeyVaultSecret
这篇关于Azure密钥保管库:使用PowerShell的备份机密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文