Issues with Get-AzureKeyVaultCertificate

Hi.
I can use Get-AzureKeyVaultSecret, but when I try Get-AzureKeyVaultCertificate I get this error:

Invoke-Expression : The term ‘Get-AzureKeyVaultCertificate’ is not recognized
October 18th 2016 14:26:36Error
as the name of a cmdlet, function, script file, or operable program. Check the
October 18th 2016 14:26:36Error
spelling of the name, or if a path was included, verify that the path is
October 18th 2016 14:26:36Error
correct and try again.
October 18th 2016 14:26:36Error
At C:\Octopus\Work\20161018122546-88\Octopus.AzureContext.ps1:49 char:2
October 18th 2016 14:26:36Error

  • Invoke-Expression ". $OctopusAzureTargetScript 
    

October 18th 2016 14:26:36Error
$OctopusAzureTargetScriptParamet …
October 18th 2016 14:26:36Error

October 18th 2016 14:26:36Error

October 18th 2016 14:26:36Error
    + CategoryInfo          : ObjectNotFound: (Get-AzureKeyVaultCertificate:St 
October 18th 2016 14:26:36Error
   ring) [Invoke-Expression], CommandNotFoundException
October 18th 2016 14:26:36Error
    + FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Co 
October 18th 2016 14:26:36Error
   mmands.InvokeExpressionCommand


Any ideas why only one of them is working. I would assume that either would both fail or none. I have no problem using the same commandlets on the VM Octopus is running on.

Hi,

Thanks for reaching out!

Do you know part of what module is Get-AzureKeyVaultCertificate? I could find some traces of the cmdlet around the web, but every time I reach to a list of Azure Key Vault cmdlets, that one doesn’t show up on the list: https://msdn.microsoft.com/library/azure/dn868052(v=azure.98).aspx

If you have that cmdlet working on anothre machine, try checking to which module it belongs there.

Thanks,
Dalmiro

Hi.
Thanks for following up this. It seems like the commandlet belongs to
AzureRM.KeyVault

[image: Inline images 1]

This commandlet is available on the VM where Octopus runs, and also on my
laptop.

Rune

And here is some more info:
https://msdn.microsoft.com/en-us/library/dn868052(v=azure.200).aspx

Are you running this script on a regular “script step” on a Tentacle? Or are you running this from Octopus on the Octopus Server machine?

It’ll ultimately depend on whether that module is installed or not on the machine running the script. So you might wanna try installing it manually and see if that works.

Hi.
Seems like Calamari 3.4.28 is using an old version (1.1.0) of
AzureRM.KeyVault. It should be 2.2.0:

[image: Inline images 2]

In the shell (where I can use get-azurekeyvaultcertificate:

[image: Inline images 1]

image.png

Hi,

That seems to be it, yeah. You can always use a custom Calamari build that includes the module version you need until we release a new version with the latest Azure module.

Regards,
Dalmiro