You can create a segment on an on-prem NSX server system by using the Invoke-PatchInfraSegment cmdlet.
To create an on-prem (flexible) segment, you must specify a transport zone and assign a subnet.
Procedure
- Retrieve transport zone details.
$tzs = Invoke-ListTransportZonesForEnforcementPoint -EnforcementpointId default -SiteId default
$tz = $tzs.Results | where {$_.DisplayName -eq $TransportZone}
- Prepare the input for the segment subnet.
$segmentSubnet = Initialize-SegmentSubnet -GatewayAddress $GatewayCIDR
- Retrieve the Tier-1 paths.
$t1s = Invoke-ListTier1
$t1 = $t1s.Results | where {$_.DisplayName -eq $T1GatewayName}
- Prepare the input for the segment.
$segment = Initialize-Segment -DisplayName $SegmentName -TransportZonePath $tz.Path `
-Subnets $segmentSubnet -ConnectivityPath $t1.Path
- Invoke the operation.
Invoke-PatchInfraSegment -Segment $segment -SegmentId $SegmentName