Get-AzVirtualNetworkSubnetConfig

Well, in this Azure PowerShell article, we will discuss the syntax and usage of the Get-AzVirtualNetworkSubnetConfig Azure PowerShell cmdlet with examples.

Get-AzVirtualNetworkSubnetConfig

Get-AzVirtualNetworkSubnetConfig is an excellent Azure PowerShell cmdlet that helps you to retrieve the details of a subnet inside a Virtual network.

Well, let’s discuss the syntax of the Get-AzVirtualNetworkSubnetConfig Azure PowerShell cmdlet.

Syntax:

Below is the syntax of the Get-AzVirtualNetworkSubnetConfig Azure PowerShell cmdlet.

Get-AzVirtualNetworkSubnetConfig
 [- Subnet Name <String>]
  -VirtualNetwork <PSVirtualNetwork>
 

Example:

The below example creates a virtual network named as MyVirtualNetwork and subnet mySubnet in the Resource Group Demo123. It then gets you the data about the subnet named as mySubnet.

$mySubnet = New-AzVirtualNetworkSubnetConfig -Name mySubnet -AddressPrefix "10.0.1.0/24"
$myvirtualNetwork = New-AzVirtualNetwork -Name MyVirtualNetwork -ResourceGroupName Demo123 -Location centralus -AddressPrefix "10.0.0.0/16" -Subnet $mySubnet
Get-AzVirtualNetworkSubnetConfig -Name mySubnet -VirtualNetwork $myvirtualNetwork

Once, I executed the above Azure PowerShell script, I got the output as below.

Name                              : mySubnet
Id                                : /subscriptions/1cdf43xx-dee9-5654-8hjy-feaa65h5cbd1/
                                         resourceGroups/Demo123/providers/Microsoft.Netwo
                                    rk/virtualNetworks/MyVirtualNetwork/subnets/mySubn
                                    et
Etag                              : W/"143cd988-1f4f-46dc-b720-c13d31cee1d1"
ProvisioningState                 : Succeeded
AddressPrefix                     : {10.0.1.0/24}
IpConfigurations                  : []
ResourceNavigationLinks           : []
ServiceAssociationLinks           : []
NetworkSecurityGroup              : null
RouteTable                        : null
NatGateway                        : null
ServiceEndpoints                  : []
ServiceEndpointPolicies           : []
PrivateEndpoints                  : []
PrivateEndpointNetworkPolicies    : Disabled
PrivateLinkServiceNetworkPolicies : Enabled

You can see it here

Get-AzVirtualNetworkSubnetConfig

You may also like following the below articles

Wrapping Up

Well, in this article, we discussed the syntax and usage of the Get-AzVirtualNetworkSubnetConfig Azure PowerShell cmdlet with examples.