AzureRmVirtualNetworkGatewayConnection uint mapping errors
Cmdlet(s)
Get-AzureRmVirtualNetworkGatewayConnection New-AzureRmVirtualNetworkGatewayConnection
PowerShell Version
5.0.10586.494
Module Version
2.0.1
OS Version
BuildVersion 10.0.10586.494
Description
I received an error getting the status of a connection. I removed it without issue to modify the local gw, but then when I tried to create the connection again it errored out with the same Int64 -> UInt64 mapping error:
get-AzureRmVirtualNetworkGatewayConnection : Missing type map configuration or unsupported mapping.
Mapping types:
Int64 -> UInt64
System.Int64 -> System.UInt64
Destination path:
PSVirtualNetworkGatewayConnection.EgressBytesTransferred.EgressBytesTransferred
Source value:
2374563
I was able to re-create the connection using the portal successfully. Once I did that, the portal was able to pull the details of the connection, but the posh cmdlets failed with the same mapping error again.
It appears there are others having this issue sporadically: https://github.com/Azure/azure-powershell/issues/2786 https://github.com/Azure/azure-powershell/issues/1812
If you need any more detail on my side let me know. I tried digging through, but my lack of familiarity with the code base and automapper led to some difficulties. I can see where those properties are defined as uints here: https://github.com/Azure/azure-powershell/blob/master/src/ResourceManager/Network/Commands.Network/Models/PSVirtualNetworkGatewayConnection.cs#L40-L42
public ulong EgressBytesTransferred { get; set; }
public ulong IngressBytesTransferred { get; set; }
But not sure why it's having difficulty converting the values from signed to unsigned or where that type map is defined.
Debug Output
get-AzureRmVirtualNetworkGatewayConnection -Name connectionname -ResourceGroupName rgname -Debug
...
DEBUG: ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://management.azure.com/subscriptions/subid/resourceGroups/rgname/providers/Microsoft.Network/connections/connectionname?api-version=2016-06-01
Headers:
x-ms-client-request-id : da6c06d1-aa6c-444d-a874-3da644bdcc64
accept-language : en-US
Body:
DEBUG: ============================ HTTP RESPONSE ============================
Status Code:
OK
Headers:
Pragma : no-cache
x-ms-request-id : f6b1be94-e98a-4cc1-972d-87be61e60b83
Strict-Transport-Security : max-age=31536000; includeSubDomains
Cache-Control : no-cache
Server : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0
x-ms-ratelimit-remaining-subscription-reads: 14978
x-ms-correlation-request-id : b5990ffa-de64-48e4-9fd0-355e2ff6322b
x-ms-routing-request-id : SOUTHCENTRALUS:20160831T232017Z:b5990ffa-de64-48e4-9fd0-355e2ff6322b
Date : Wed, 31 Aug 2016 23:20:16 GMT
Body:
{
"name": "connectionname",
"id": "/subscriptions/subid/resourceGroups/rgname/providers/Microsoft.Network/connections/connectionname",
"etag": "W/\"b9597bfd-6885-4024-84df-7d4a85102a6c\"",
"type": "Microsoft.Network/connections",
"location": "centralus",
"properties": {
"provisioningState": "Succeeded",
"resourceGuid": "guid",
"virtualNetworkGateway1": {
"id": "/subscriptions/subid/resourceGroups/rgname/providers/Microsoft.Network/virtualNetworkGateways/gwname"
},
"localNetworkGateway2": {
"id": "/subscriptions/subid/resourceGroups/rgname/providers/Microsoft.Network/localNetworkGateways/localgwname"
},
"connectionType": "IPsec",
"routingWeight": 0,
"sharedKey": "redacted",
"enableBgp": false,
"connectionStatus": "Connected",
"ingressBytesTransferred": 2858474,
"egressBytesTransferred": 2374563
}
}
get-AzureRmVirtualNetworkGatewayConnection : Missing type map configuration or unsupported mapping.
Mapping types:
Int64 -> UInt64
System.Int64 -> System.UInt64
Destination path:
PSVirtualNetworkGatewayConnection.EgressBytesTransferred.EgressBytesTransferred
Source value:
2374563
At line:1 char:1
+ get-AzureRmVirtualNetworkGatewayConnection -Name connectionname -Reso ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmVirt...tewayConnection], AutoMapperMappingException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.GetAzureVirtualNetworkGatewayConnectionCommand
DEBUG: 6:20:29 PM - GetAzureVirtualNetworkGatewayConnectionCommand end processing.
DEBUG: 6:20:29 PM - GetAzureVirtualNetworkGatewayConnectionCommand end processing.
@DeepakRajendranMsft Hey Deepak, would you mind taking a look at this issue?
I am getting this error with Get-AzureRmVirtualNetworkGatewayConnection and a different mapping types error (UInt64 -> Nullable`1) with New-AzureRmVirtualNetworkGatewayConnection
Version:
> Get-Module AzureRM | Select-Object Version
Version
-------
2.1.0
Examples:
> get-AzureRmVirtualNetworkGatewayConnection -Name $ConName -ResourceGroupName $RGName
get-AzureRmVirtualNetworkGatewayConnection : Missing type map configuration or unsupported mapping.
Mapping types:
Int64 -> UInt64
System.Int64 -> System.UInt64
Destination path:
PSVirtualNetworkGatewayConnection.EgressBytesTransferred.EgressBytesTransferred
Source value:
0
At line:1 char:1 onprem
+ get-AzureRmVirtualNetworkGatewayConnection -Name azure-to-onprem-tu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmVirt...tewayConnection], AutoMapperMappingException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.GetAzureVirtualNetworkGatewayConnectionCommand
> New-AzureRmVirtualNetworkGatewayConnection -Name $ConName -ResourceGroupName $RGName `
-Location 'East US' -VirtualNetworkGateway1 $gateway1 -LocalNetworkGateway2 $local `
-ConnectionType IPsec -RoutingWeight 10 -SharedKey $key
WARNING: The output object type of this cmdlet will be modified in a future release.
New-AzureRmVirtualNetworkGatewayConnection :
Mapping types:
UInt64 -> Nullable`1
System.UInt64 -> System.Nullable`1[[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
Destination path:
VirtualNetworkGatewayConnection.EgressBytesTransferred.EgressBytesTransferred
Source value:
0
At line:1 char:1
+ New-AzureRmVirtualNetworkGatewayConnection -Name azure-to-onprem-tu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmVirt...tewayConnection], AutoMapperMappingException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.NewAzureVirtualNetworkGatewayConnectionCommand
Looping @markjbrown as it looks like he identified a similar (same?) issue #1812 back in May. I tried multiple things, including installing older versions of AzureRM / AzureRM.Network with no success:
> Get-Module AzureRM | Select-Object Version
Version
-------
1.5.0
Getting the same error
get-azurermvirtualnetworkgatewayconnection : Missing type map configuration or unsupported mapping.
Mapping types:
Int64 -> UInt64
System.Int64 -> System.UInt64
Destination path:
PSVirtualNetworkGatewayConnection.EgressBytesTransferred.EgressBytesTransferred
Source value:
0
At line:1 char:10
+ $conn1 = get-azurermvirtualnetworkgatewayconnection -Name "Primary" - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureRmVirt...tewayConnection], AutoMapperMappingException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.GetAzureVirtualNetworkGatewayConnectionCommand
In my case, I need to create a new virtual network gateway connection and enable BGP, is there a work-around that doesn't involve using the new-azurermvirtualnetworkgatewayconnection commandlet?
Has anyone come up with a solution to this? I receive the same error when trying to create a connection using New-AzureRmVirtualNetworkGatewayConnection. Is there any other way to enable BGP aside from powershell?
same issue :(
Same issue but with Get-AzureRmApplicationGateway and I'm trying to create a Web Application Firewall and that can't be done by JSON yet. Very frustrating.
@markjbrown were you able to ever resolve the same issues you were having around this?
Same issue here with New-AzureRmVirtualNetworkGatewayConnection:
PS C:\Users\jbrad> New-AzureRmVirtualNetworkGatewayConnection -Name 'JBLAB-S2S' -ResourceGroupName 'JBLAB-RG' -Location CanadaEast -VirtualNetworkGate
way1 $VNetGW -LocalNetworkGateway2 $LocalGW -ConnectionType 'IPSec' -RoutingWeight 10 -SharedKey 'abc123'
WARNING: The output object type of this cmdlet will be modified in a future release.
New-AzureRmVirtualNetworkGatewayConnection :
Mapping types:
UInt64 -> Nullable1
System.UInt64 -> System.Nullable1[[System.Int64, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]
Destination path:
VirtualNetworkGatewayConnection.EgressBytesTransferred.EgressBytesTransferred
Source value:
0
At line:1 char:1
- New-AzureRmVirtualNetworkGatewayConnection -Name 'JBLAB-S2S' -Resourc ...
-
+ CategoryInfo : CloseError: (:) [New-AzureRmVirt...tewayConnection], AutoMapperMappingException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.NewAzureVirtualNetworkGatewayConnectionCommand
Let me get with our team and take another look at this. Will update here.
thanks.
I have had this problem for a long time. I resolved it by removing AzureRm installed with powershell and instead installed using the msi.
Thanks @inghak. Will look more closely at that.
Thanks @inghak
For others: I tested just installing the msi from https://github.com/Azure/azure-powershell/releases without first removing the azure package and it worked flawlessly.
@inghak @Fazered Thank you. This also resolved my issue today.
I just hit this issue again running Get-AzureRMApplicationGateway and installled "over the top" of existing installation as per @Fazered s post above and fixed for me
I tried doing this but it is still a problem for me. I have tried it on different type of connections and all get the same issue! Any ideas on why it happens?
hi there, i tried the work-around with no luck. Any ETA on a fix ?
Thanks!
Update - I tried reinstalling via PS Gallery and MSI but that didn't help. What fixed the issue for me was completely removing it via "Uninstall programs" and then installing it via Microsoft Web Platform Installer
PS C:\WINDOWS\system32> Get-AzureRmVirtualNetworkGatewayConnection -Name REMOVED -ResourceGroupName REMOVED -Debug DEBUG: 10:12:53 AM - GetAzureVirtualNetworkGatewayConnectionCommand begin processing with ParameterSet '__AllParameterSets'.
DEBUG: ============================ HTTP RESPONSE ============================
Status Code: OK
Headers: Pragma : no-cache x-ms-request-id : REMOVED Strict-Transport-Security : max-age=31536000; includeSubDomains Cache-Control : no-cache Server : Microsoft-HTTPAPI/2.0,Microsoft-HTTPAPI/2.0 x-ms-ratelimit-remaining-subscription-reads: 14975 x-ms-correlation-request-id : REMOVED x-ms-routing-request-id : REMOVED:20170213T151256Z:REMOVED Date : Mon, 13 Feb 2017 15:12:56 GMT
Body: { "name": "REMOVED", "id": "/subscriptions/REMOVED/resourceGroups/REMOVED/providers/Microsoft.Network/connections/REMOVED", "etag": "W/"REMOVED"", "type": "Microsoft.Network/connections", "location": "REMOVED", "properties": { "provisioningState": "Succeeded", "resourceGuid": "REMOVED", "virtualNetworkGateway1": { "id": "/subscriptions/REMOVED/resourceGroups/REMOVED/providers/Microsoft.Network/virtualNetworkGateways/REMOVED" }, "virtualNetworkGateway2": { "id": "/subscriptions/REMOVED/resourceGroups/REMOVED/providers/Microsoft.Network/virtualNetworkGateways/REMOVED" }, "connectionType": "Vnet2Vnet", "routingWeight": 0, "sharedKey": "REMOVED", "enableBgp": false, "connectionStatus": "Connected", "ingressBytesTransferred": 3567687239, "egressBytesTransferred": 2986874728 } }
Confirm Missing type map configuration or unsupported mapping.
Mapping types: Int64 -> UInt64 System.Int64 -> System.UInt64
Destination path: PSVirtualNetworkGatewayConnection.EgressBytesTransferred.EgressBytesTransferred
Source value: 2986874728 [Y] Yes [A] Yes to All [H] Halt Command [S] Suspend [?] Help (default is "Y"): A Get-AzureRmVirtualNetworkGatewayConnection : Missing type map configuration or unsupported mapping. Mapping types: Int64 -> UInt64 System.Int64 -> System.UInt64 Destination path: PSVirtualNetworkGatewayConnection.EgressBytesTransferred.EgressBytesTransferred Source value: 2986874728 At line:1 char:1
- Get-AzureRmVirtualNetworkGatewayConnection -Name REMOVED - ...
-
+ CategoryInfo : CloseError: (:) [Get-AzureRmVirt...tewayConnection], AutoMapperMappingException + FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.GetAzureVirtualNetworkGatewayConnectionCommand
DEBUG: 10:13:16 AM - GetAzureVirtualNetworkGatewayConnectionCommand end processing. DEBUG: 10:13:16 AM - GetAzureVirtualNetworkGatewayConnectionCommand end processing. PS C:\WINDOWS\system32> Get-Module AzureRM | Select-Object Version
Version
3.5.0
Hi there, Today I got this error. Why has this problem been left for such a long time? Module version 3.7
I went on a long journey. Follow me, If you like :D
It seems to be falling here. Https://github.com/Azure/azure-powershell/blob/dev/src/ResourceManager/Network/Commands.Network/VirtualNetworkGatewayConnection/VirtualNetworkGatewayConnectionBaseCmdlet.cs#L66
Mapping was defined here. Https://github.com/Azure/azure-powershell/blob/dev/src/ResourceManager/Network/Commands.Network/Common/NetworkResourceManagerProfile.cs#L387
MNM.VirtualNetworkGatewayConnection is the type of Azure SDK. In my opinion. The source of the SDK is here. Https://github.com/Azure/azure-sdk-for-net/blob/AutoRest/src/ResourceManagement/Network/Microsoft.Azure.Management.Network/Generated/Models/VirtualNetworkGatewayConnection.cs#L155
This source is generated by swagger. The latest definition is here. Https://github.com/Azure/azure-rest-api-specs/blob/master/arm-network/2017-03-01/swagger/virtualNetworkGateway.json#L1425
Looking at it, EgressBytesTransferred and IngressBytesTransferred are signed 64 bit int.
My conclusion is to change the model of PowerShell's model class EgressBytesTransferred and IngressBytesTransferred. Here. Https://github.com/Azure/azure-powershell/blob/master/src/ResourceManager/Network/Commands.Network/Models/PSVirtualNetworkGatewayConnection.cs#L41
What do you think? If you agree, I will create a PR.
Shortest reproduction step.
- Start new PowerShell session
- Login-AzureRmAccount
- Get-AzureRmVM -ErrorAction SilentlyContinue | Out-Null
- Get-AzureRmVirtualNetworkGatewayConnection -ResourceGroupName *****
I got following errors.
Get-AzureRmVirtualNetworkGatewayConnection: Missing type map configuration or unsupported mapping.
Mapping types:
Int64 -> UInt 64
System.Int64 -> System.UInt64
Destination path:
PSVirtualNetworkGatewayConnection.EgressBytesTransferred.EgressBytesTransferred
Source value:
0
When not execute step 3 'Get-AzureRmVM'. Everything works fine.
Root cause:
AzureRm.Network and AzureRm.Compute use AutoMapper 3.1.1, but AzureRm.Compute does not include AutoMapper.Net4.dll which is .NET 4 PlatformSpecificMapper. The converter of System.Int64 -> System.UInt64 is included in AutoMapper.Net4.dll. Since AutoMapper 's default converter is initialized only once, when AzureRm.Compute is executed for the first time, the converter of System.Int64 -> System.UInt64 is not included in the default converter.
On the other hand, AzureRm.Network refers to AutoMapper.Net4.dll. When AutoMapper is initialized in the context of AzureRm.Network, the converter of System.Int64 -> System.UInt64 is included in the default converter.
I spent a lot of time for reproducing this problem in last week. I will create a PR again.
This should be fixed by #3715. The fix will go out in the May release.