Search code examples
azurepowershellazure-service-fabricazure-keyvault

What does Object reference not set to an instance of an object error mean when using Add-AzServiceFabricClusterCertificate?


I'm trying to add a new secondary cert to the service fabric, however I receive the following error. does any one have any pointers?

PS C:\WINDOWS\system32> Add-AzServiceFabricClusterCertificate -ResourceGroupName '******'  -Name '********'  -SecretIdentifier '*************'  
Add-AzServiceFabricClusterCertificate : Object reference not set to an instance of an object.
At line:1 char:1
+ Add-AzServiceFabricClusterCertificate -ResourceGroupName '****
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : CloseError: (:) [Add-AzServiceFabricClusterCertificate], NullReferenceException
    + FullyQualifiedErrorId : Microsoft.Azure.Commands.ServiceFabric.Commands.AddAzureRmServiceFabricClusterCertificate

Solution

  • I could not reproduce your issue, it works on my side.

    Try to update the Az.ServiceFabric with the command below, my version is 2.0.1.

    Update-Module -Name Az.ServiceFabric -Force
    

    In azure keyvault, I use a self-signed certificate, make sure you use the SecretIdentifier below.

    enter image description here

    Then use the powershell and check the result in the portal.

    Add-AzServiceFabricClusterCertificate -ResourceGroupName '<group-name>' -Name 'joyfabric' -SecretIdentifier 'https://joykeyvault.vault.azure.net/secrets/cer135/23c6706daeab47e59caca2431ad96a1c'
    

    enter image description here