Edit

Share via


Test-AzPrivateIPAddressAvailability

Test availability of a private IP address in a virtual network.

Syntax

TestByResource

Test-AzPrivateIPAddressAvailability
    -VirtualNetwork <PSVirtualNetwork>
    -IPAddress <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

TestByResourceId

Test-AzPrivateIPAddressAvailability
    -ResourceGroupName <String>
    -VirtualNetworkName <String>
    -IPAddress <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Test-AzPrivateIPAddressAvailability cmdlet tests whether a specified private IP address is available in a virtual network. This cmdlet returns a list of available private IP addresses if the requested private IP address is taken.

Examples

Example 1: Test whether an IP address is available using the pipeline

Get-AzVirtualNetwork -Name $vnetName -ResourceGroupName $rgname | Test-AzPrivateIPAddressAvailability -IPAddress "10.0.1.10"

This command gets a virtual network and uses the pipeline operator to pass it to Test-AzPrivateIPAddressAvailability, which tests whether the specified private IP address is available.

Parameters

-DefaultProfile

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

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-IPAddress

Specifies the IP address to test.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-ResourceGroupName

Specifies the name of the resource group for the virtual network.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

TestByResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-VirtualNetwork

Specifies a PSVirtualNetwork object.

Parameter properties

Type:PSVirtualNetwork
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

TestByResource
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-VirtualNetworkName

Specifies the name of the virtual network.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

TestByResourceId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

PSVirtualNetwork

Outputs

PSIPAddressAvailabilityResult