Test-AzureRmPrivateIPAddressAvailability

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

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

Test-AzureRmPrivateIPAddressAvailability
    -VirtualNetwork <PSVirtualNetwork>
    -IPAddress <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]
Test-AzureRmPrivateIPAddressAvailability
    -ResourceGroupName <String>
    -VirtualNetworkName <String>
    -IPAddress <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

The Test-AzureRmPrivateIPAddressAvailability 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

PS C:\>Get-AzureRmVirtualNetwork -Name $vnetName -ResourceGroupName $rgname | Test-AzureRmPrivateIPAddressAvailability -IPAddress "10.0.1.10"

This command gets a virtual network and uses the pipeline operator to pass it to Test-AzureRmPrivateIPAddressAvailability, 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: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

Parameters: VirtualNetwork (ByValue)

Outputs

PSIPAddressAvailabilityResult