Redigera

Dela via


Test-AzPrivateIPAddressAvailability

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

Syntax

Test-AzPrivateIPAddressAvailability
    -VirtualNetwork <PSVirtualNetwork>
    -IPAddress <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]
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.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-IPAddress

Specifies the IP address to test.

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

-ResourceGroupName

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

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

-VirtualNetwork

Specifies a PSVirtualNetwork object.

Type:PSVirtualNetwork
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-VirtualNetworkName

Specifies the name of the virtual network.

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

Inputs

PSVirtualNetwork

Outputs

PSIPAddressAvailabilityResult