Quantcast
Channel: Azure Networking (DNS, Traffic Manager, VPN, VNET) forum
Viewing all articles
Browse latest Browse all 6513

Creation of a Virtual Network Gateway error Object reference not set to an instance of an object.

$
0
0

I was asked to post my problem here by ^PB on Twitter (See https://twitter.com/AzureSupport/status/1023333881104277504)

I am running against an error when I try (on different Azure accounts) to execute the commandlet New-AzureRmVirtualNetworkGateway, even if I use the 1st example given on the Docs page here: https://docs.microsoft.com/en-us/powershell/module/azurerm.network/new-azurermvirtualnetworkgateway?view=azurermps-6.5.0#examples

$Gateway.Name = MivexLabAzGateway

$ResourceGroup.Name = MivexLabAzResourceGroup

$Gateway.Location = West Europe

This is the error I get (with debugging on):

PS > $objectVirtualNetworkGateway = New-AzureRmVirtualNetworkGateway `

-Name $Gateway.Name ` -ResourceGroupName $ResourceGroup.Name ` -Location $Gateway.Location DEBUG: 16:14:09 - NewAzureVirtualNetworkGatewayCommand begin processing with ParameterSet 'Default'. [Removed Authentication hashes etc] DEBUG: ============================ HTTP REQUEST ============================ HTTP Method: GET Absolute Uri: https://management.azure.com/subscriptions/3e60c2bd-4028-4610-8f8d-975c465292c4/resourceGroups/MivexLabAzResourceGroup/providers/Microsoft.Network/virtualNetworkGateways/MivexLabAzGateway?api-version=2018-04-01 Headers: x-ms-client-request-id : 5c483e5b-786f-44bf-87e8-bc2fff126758 accept-language : en-US Body: DEBUG: ============================ HTTP RESPONSE ============================ Status Code: NotFound Headers: Pragma : no-cache x-ms-failure-cause : gateway x-ms-request-id : a0dc334a-05eb-4713-949b-355545ac8c42 x-ms-correlation-request-id : a0dc334a-05eb-4713-949b-355545ac8c42 x-ms-routing-request-id : CANADAEAST:20180729T141412Z:a0dc334a-05eb-4713-949b-355545ac8c42 Strict-Transport-Security : max-age=31536000; includeSubDomains X-Content-Type-Options : nosniff Cache-Control : no-cache Date : Sun, 29 Jul 2018 14:14:11 GMT Body: { "error": {"code": "ResourceNotFound","message": "The Resource 'Microsoft.Network/virtualNetworkGateways/MivexLabAzGateway' under resource group 'MivexLabAzResourceGroup' was not found." } } New-AzureRmVirtualNetworkGateway : Object reference not set to an instance of an object. At line:1 char:32 + $objectVirtualNetworkGateway = New-AzureRmVirtualNetworkGateway `+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo : CloseError: (:) [New-AzureRmVirtualNetworkGateway], NullReferenceException+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.NewAzureVirtualNetworkGatewayCommand DEBUG: AzureQoSEvent: CommandName - New-AzureRmVirtualNetworkGateway; IsSuccess - False; Duration - 00:00:00.7484642; Exception - System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Azure.Commands.Network.NewAzureVirtualNetworkGatewayCommand.CreateVirtualNetworkGateway() at Microsoft.Azure.Commands.Network.NewAzureVirtualNetworkGatewayCommand.<Execute>b__88_0() at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ConfirmAction(Boolean force, String continueMessage, String processMessage, String target, Action action, Func`1 useShouldContinue) at Microsoft.Azure.Commands.Network.NewAzureVirtualNetworkGatewayCommand.Execute() at Microsoft.Azure.Commands.Network.NetworkBaseCmdlet.ExecuteCmdlet() at Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet.ProcessRecord(); DEBUG: Finish sending metric. DEBUG: 16:14:11 - NewAzureVirtualNetworkGatewayCommand end processing. DEBUG: 16:14:11 - NewAzureVirtualNetworkGatewayCommand end processing.

I think I am going crazy, because I was able to create and use the VPN gateway before! But trying to troubleshoot with different accounts does not get me any further, and trying to do exactly what is done in the example (except the location to west Europe)

Please let me know if you actually need the authentication part.




Viewing all articles
Browse latest Browse all 6513

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>