Blog icon indicating copy to clipboard operation
Blog copied to clipboard

Getting an exception while running this.

Open sonalis04 opened this issue 4 years ago • 6 comments

Exception calling "AddRange" with "1" argument(s): "Collection cannot be null. Parameter name: c" At line:85 char:1

  • $allKeyVaultObjects.AddRange((Get-AzureKeyVaultObjectKeys -VaultName ...
  •   + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : ArgumentNullException
    

sonalis04 avatar Nov 13 '20 00:11 sonalis04

Sorry, Can you give more details on what you are trying to run? this repository has all my blog samples so can't tell which one this is relating to.

rahulpnath avatar Nov 13 '20 00:11 rahulpnath

Sorry Rahul! My bad - I was trying to run the KeyVault Expiry Alerter.

https://github.com/rahulpnath/Blog/blob/master/KeyVaultExpiryAlerter/Expiry%20Alert.ps1

sonalis04 avatar Nov 13 '20 01:11 sonalis04

No worries - It's been a long time since I have written this. are there any keys in the key vault that you are connecting to? Looks like that might be an issue and something that needs to be handled there?

rahulpnath avatar Nov 13 '20 01:11 rahulpnath

Oh, possible - I would take a look to that Rahul. Would you know if I can do it for all KeyVaults within a sub, I tried specifying multiple keyvaults within the keyvault, but that didn't work.

sonalis04 avatar Nov 13 '20 01:11 sonalis04

The current script is for one vault - You will need to modify it to loop through multiple if you want. Let me know if you are able to solve the issue. In case you run into any fixes for the script, would be great if you can raise a PR 😀

rahulpnath avatar Nov 13 '20 02:11 rahulpnath

@sonalis04 Did you have any luck with this?

rahulpnath avatar Jun 13 '21 06:06 rahulpnath