1

even I can see the virtual network still can not get the specific virtual network subnet info from Azure powershell1.4.0.

PS C:\Users\mwang> Get-AzureRmVirtualNetwork |more |Select-String name |more

Name : ToolBelt ResourceGroupName : ToolBelt "Name": "ToolBelt_GTPROD.local", "Name": "ToolBelt_GTPROD", Name : TestVNet ResourceGroupName : BI-Reporting-VPN "Name": "FrontEnd", "Name": "Backend", "Name": "GatewaySubnet", Name : GTGLOBAL.LOCAL ResourceGroupName : GTGLOBAL "Name": "GTGLOBAL1", "Name": "GatewaySubnet", "Name": "NetworkLoadBalancer", "Name": "BarracudaLB", "Name": "DMZ", Name : GTLB ResourceGroupName : GTLB "Name": "default", Name : KW-network ResourceGroupName : KW "Name": "default",

PS C:\Users\mwang> Get-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork KW-network Get-AzureRmVirtualNetworkSubnetConfig : Cannot bind parameter 'VirtualNetwork'. Cannot convert the "KW-network" value of type "System.String" to type "Microsoft.Azure.Commands.Network.Models.PSVirtualNetwork". At line:1 char:55 + Get-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork KW-network + ~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Get-AzureRmVirtualNetworkSubnetConfig], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Azure.Commands.Network.GetAzureVirtualNetworkSu bnetConfigCommand

PS C:\Users\mwang> Get-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork GTGLOBAL.LOCAL Get-AzureRmVirtualNetworkSubnetConfig : Cannot bind parameter 'VirtualNetwork'. Cannot convert the "GTGLOBAL.LOCAL" value of type "System.String" to type "Microsoft.Azure.Commands.Network.Models.PSVirtualNetwork". At line:1 char:55 + Get-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork GTGLOBAL.LOCAL + ~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument: (:) [Get-AzureRmVirtualNetworkSubnetConfig], ParameterBindingException + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.Azure.Commands.Network.GetAzureVirtualNetworkSu bnetConfigCommand

PS C:\Users\mwang>

2 Answers 2

1

The error clearly states that it cannot bind a string value . It should be passed as a variable.Here is an example below

    $vnetname=Get-AzureRmVirtualNetwork -Name <value> -ResourceGroupName <value>

now pass this variable to the getsubnet command as below:

    Get-AzureRmVirtualNetworkSubnetconfig -VirtualNetwork $vnetname
0

You're passing a wrong parameter in the last call:

Get-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork GTGLOBAL.LOCAL

It should be something like:

Get-AzureRmVirtualNetwork "GTGLOBAL.LOCAL" | Get-AzureRmVirtualNetworkSubnetConfig ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .