Azure / Azure/azure-powershell
Add-AzureRmVpnClientRootCertificate throws object ref exception
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 4.3k
- Avg merge
- 3d 14h
- Merged PRs (30d)
- 54
Description
We're trying to add a cert to an existing VNet Gateway for a point-to-site VPN connection. However, the Add-AzureRmVpnClientRootCertificate cmdlet is throwing an "Object reference not set to an instance of an object." exception. This is reproducible on multiple Win 7 machines and with AzureRM modules 1.2.0 and 1.2.2.
Here's a copy of a PS session that demonstrates the error and shows the exception stacktrace.
```
PS C:\Users\bens> add-azurermvpnclientrootcertificate -vpnclientrootcertificatename "NCCert" -virtualnetworkgatewayname DevVNG2 -resourcegroupname DevRG -publiccertdata "[certdatahere]"
add-azurermvpnclientrootcertificate : Object reference not set to an instance of an object.
At line:1 char:1
+ add-azurermvpnclientrootcertificate -vpnclientrootcertificatename "NC ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Add-AzureRmVpnClientRootCertificate], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.AddAzureVpnClientRootCertificateCommand
PS C:\Users\bens> $error[0].exception.stacktrace
at Microsoft.Azure.Commands.Network.AddAzureVpnClientRootCertificateCommand.ExecuteCmdlet() in d:\workspace\powershe
l-publish\src\ResourceManager\Network\Commands.Network\VirtualNetworkGateway\AddAzureVpnClientRootCertificateCommand.cs
line 101
at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord() in d:\workspace\powershell-publish
src\Common\Commands.Common\AzurePSCmdlet.cs:line 545
PS C:\Users\bens> get-module azurerm
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.2.2 AzureRM {CheckIncompatibleVersion, Import-AzureRM, Install-ModuleW.
```
Contributor guide
Assessment
This issue has not been assessed yet.