0
votes

I am wanting to do a back up of one key vault and restore it to another. But, as far as I can tell, this API that is well documented, doesn't really exist. There is the Backup-​Azure​Key​Vault​Secret as well as Backup of other KeyVault items, and they simply don't seem to exist anywhere. I like the idea - it can only be restored to that subscription - and I need to duplicate a key vault. (There should be a Backup-​Azure​Key​Vault​ but I can't find any docs on that)

I've tried running it powershell - where I can run commands to get or set keys, certs etc and all the other commands work.

I tried running it from the portal's command window and it doesn't run there either.

I tried upgrading the Module: AzureRM.KeyVault - but it says it wasn't installed using the same tool that I was trying to upgrade it with, so it failed.

I just installed the tools, including powershell within the last month, so unless this came out in the last month I'd think that it would just work.

Thanks.

Update: I typed the command by hand to avoid any 'special chars' in the command, then I retyped it to make sure the case was exactly the same? enter image description here

What am I missing?

Update 2: I listed all the commands using 'get-command' stored it in a file, and 'grep'ed it for AzureRM.KeyVault and this is the output (I can backup/restore Keys but not Certs or Secrets??):

Cmdlet          Add-AzureKeyVaultCertificate                       2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Add-AzureKeyVaultCertificateContact                2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Add-AzureKeyVaultKey                               2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Backup-AzureKeyVaultKey                            2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Get-AzureKeyVaultCertificate                       2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Get-AzureKeyVaultCertificateContact                2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Get-AzureKeyVaultCertificateIssuer                 2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Get-AzureKeyVaultCertificateOperation              2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Get-AzureKeyVaultCertificatePolicy                 2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Get-AzureKeyVaultKey                               2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Get-AzureKeyVaultSecret                            2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Get-AzureRmKeyVault                                2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Import-AzureKeyVaultCertificate                    2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          New-AzureKeyVaultCertificateAdministratorDetails   2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          New-AzureKeyVaultCertificateOrganizationDetails    2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          New-AzureKeyVaultCertificatePolicy                 2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          New-AzureRmKeyVault                                2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Remove-AzureKeyVaultCertificate                    2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Remove-AzureKeyVaultCertificateContact             2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Remove-AzureKeyVaultCertificateIssuer              2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Remove-AzureKeyVaultCertificateOperation           2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Remove-AzureKeyVaultKey                            2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Remove-AzureKeyVaultSecret                         2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Remove-AzureRmKeyVault                             2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Remove-AzureRmKeyVaultAccessPolicy                 2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Restore-AzureKeyVaultKey                           2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Set-AzureKeyVaultCertificateAttribute              2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Set-AzureKeyVaultCertificateIssuer                 2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Set-AzureKeyVaultCertificatePolicy                 2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Set-AzureKeyVaultKeyAttribute                      2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Set-AzureKeyVaultSecret                            2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Set-AzureKeyVaultSecretAttribute                   2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Set-AzureRmKeyVaultAccessPolicy                    2.1.0      AzureRM.KeyVault                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Cmdlet          Stop-AzureKeyVaultCertificateOperation             2.1.0      AzureRM.KeyVault        
1
That error is usually pretty accurate in that PS can't find the cmdlets... it could be a bad install or incorrect path, etc... If you run Get-Module AzureRM.KeyVault -ListAvailable what does it return? And is Backup-* one of the exported cmds?bmoore-msft
ModuleType Version Name ExportedCommands Manifest 2.1.0 AzureRM.KeyVault {Add-AzureKeyVaultCertificate, Set-AzureKeyVaultCertificateAttribute, Stop-AzureKeyVaultCertificateOperation, Get-AzureKeyVaultCertificateOperation...}Traderhut Games
It cuts it off, so there is no way to know :-( It says it is 2.1.0 though, is that the issue?Traderhut Games
I just tried just 'Get-module -all' and it showed 'Backup-AzureKeyVaultKey...' which, I verified I was able to run that command (to backup a key), but the Secret one doesn't seem to exist.Traderhut Games
I think I figured it out. I ran: Install-Module -Name AzureRM -allowclobber (AllowClobber required, it is also untrusted from PowerShell Gallery), and then when I ran the command it asked me if I wanted to run it, I said A, and then it gave me an error saying the command didn't exist. I did the same thing as Admin and it ran. It now shows up in the list, and can be run (as admin only) I had tried running as admin before and it failed. Apparently, recently installing Power Shell, it installed version 2.1, and the current is 4.1 - Sounds like updates were needed to the install.Traderhut Games

1 Answers

0
votes

The command you provide has some special characters, it is the reason that you could use the command.

enter image description here

Please use command Backup-AzureKeyVaultSecret. You could look carefully they are different. -​ is wrong.

Update:

If it does not work for you, I suggest you could install Azure PowerShell with .msi installer, you could download it from the link.