Not sure why the Get-AzureRmVirtualNetworkSubnetConfig Fails, any help?
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
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