Get-AzureRmVirtualNetworkSubnetConfig Fails

This topic contains 3 replies, has 2 voices, and was last updated by Profile photo of Soma sympli Soma sympli 1 month, 1 week ago.

  • Author
    Posts
  • #55861
    Profile photo of Soma sympli
    Soma sympli
    Participant

    https://gist.github.com/3027f290563ce00c4d58ef7f2f79d436.git

    Not sure why the Get-AzureRmVirtualNetworkSubnetConfig Fails, any help?

  • #55867
    Profile photo of Soma sympli
    Soma sympli
    Participant
  • #55877
    Profile photo of Rob Simmers
    Rob Simmers
    Participant

    The error:

    Get-AzureRmVirtualNetworkSubnetConfig : Cannot bind parameter 'VirtualNetwork'. Cannot convert the "VNET1" value of type "System.String" to type 
    "Microsoft.Azure.Commands.Network.Models.PSVirtualNetwork".
    

    indicates that the cmdlet is expecting a PSVirtualNetwork and not a String (e.g. VNET1). Try using Get-AzureRmVirtualNetwork to get the network prior calling Get-AzureRmVirtualNetworkSubnetConfig. Try something like this:

    Get-AzureRmVirtualNetwork -Name VNET1 | Get-AzureRmVirtualNetworkSubnetConfig
    
  • #55880
    Profile photo of Soma sympli
    Soma sympli
    Participant

    Tried that as well didnt work, somtimes it works and sometimes it doest, not sure why..

    PS C:\Windows\system32> Get-AzureRmVirtualNetwork -ResourceGroupName $resourceGroup|Get-AzureRmVirtualNetworkSubnetConfig -VirtualNetwork $vnet -Name Subnet02

    Get-AzureRmVirtualNetworkSubnetConfig : Cannot convert 'System.Object[]' to the type

    'Microsoft.Azure.Commands.Network.Models.PSVirtualNetwork' required by parameter
    'VirtualNetwork'. Specified method is not supported.
    At line:1 char:115
    + ... VirtualNetwork $vnet -Name Subnet02
    + ~~~~~
    + CategoryInfo : InvalidArgument: (:) [Get-AzureRmVirtualNetworkSubnetConfig], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgument,Microsoft.Azure.Commands.Network.GetAzureVirtualNetworkSubnetConfigCommand

You must be logged in to reply to this topic.