Get-AzureRmVirtualNetworkSubnetConfig

Gets a subnet in a virtual network.

Syntax

Get-AzureRmVirtualNetworkSubnetConfig
   [-Name <String>]
   -VirtualNetwork <PSVirtualNetwork>
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]

Description

The Get-AzureRmVirtualNetworkSubnetConfig cmdlet gets one or more subnet configurations in an Azure virtual network.

Examples

1: Get a subnet in a virtual network

New-AzureRmResourceGroup -Name TestResourceGroup -Location centralus
    $frontendSubnet = New-AzureRmVirtualNetworkSubnetConfig -Name frontendSubnet 
    -AddressPrefix "10.0.1.0/24"
    $virtualNetwork = New-AzureRmVirtualNetwork -Name MyVirtualNetwork -ResourceGroupName 
    TestResourceGroup -Location centralus -AddressPrefix "10.0.0.0/16" -Subnet $frontendSubnet
    Get-AzureRmVirtualNetworkSubnetConfig -Name frontendSubnet -VirtualNetwork $virtualNetwork

This example creates a resource group and a virtual network with a single subnet in that resource group. It then retrieves data about that subnet.

Required Parameters

-VirtualNetwork

Specifies the VirtualNetwork object that contains the subnet configuration that this cmdlet gets.

Type:Microsoft.Azure.Commands.Network.Models.PSVirtualNetwork
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False

Optional Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure.

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Name

Specifies the name of the subnet configuration that this cmdlet gets.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

PSVirtualNetwork

Parameter 'VirtualNetwork' accepts value of type 'PSVirtualNetwork' from the pipeline

Outputs

Microsoft.Azure.Commands.Network.Models.PSSubnet