Remove-AzCognitiveServicesAccountNetworkRule

Remove IpRules or VirtualNetworkRules from the NetWorkRule property of a Cognitive Services account

Syntax

Remove-AzCognitiveServicesAccountNetworkRule
      [-ResourceGroupName] <String>
      [-Name] <String>
      -VirtualNetworkResourceId <String[]>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzCognitiveServicesAccountNetworkRule
      [-ResourceGroupName] <String>
      [-Name] <String>
      -IpRule <PSIpRule[]>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzCognitiveServicesAccountNetworkRule
      [-ResourceGroupName] <String>
      [-Name] <String>
      -VirtualNetworkRule <PSVirtualNetworkRule[]>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-AzCognitiveServicesAccountNetworkRule
      [-ResourceGroupName] <String>
      [-Name] <String>
      -IpAddressOrRange <String[]>
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-AzCognitiveServicesAccountNetworkRule cmdlet removes IpRules or VirtualNetworkRules from the NetWorkRule property of a Cognitive Services account

Examples

Example 1: Remove several IpRules with IPAddressOrRange

PS C:\>Remove-AzCognitiveServicesAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "myaccount" -IpAddressOrRange "10.0.0.0/24,28.1.0.0/16"

This command remove several IpRules with IPAddressOrRange.

Example 2: Remove a VirtualNetworkRule with VirtualNetworkRule Object input with JSON

PS C:\>Remove-AzCognitiveServicesAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "myaccount" -VirtualNetworkRules (@{VirtualNetworkReourceId="/subscriptions/s1/resourceGroups/g1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"})

This command remove a VirtualNetworkRule with VirtualNetworkRule Object input with JSON.

Example 3: Remove first IpRule with pipeline

PS C:\>(Get-AzCognitiveServicesAccountNetworkRuleSet -ResourceGroupName "myResourceGroup" -Name "myaccount").IpRules[0] | Remove-AzCognitiveServicesAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "myaccount"

This command remove first IpRule with pipeline.

Example 4: Remove several VirtualNetworkRules with VirtualNetworkResourceID

PS C:\>Remove-AzCognitiveServicesAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "myaccount" -VirtualNetworkResourceId "/subscriptions/s1/resourceGroups/g1/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1","/subscriptions/s1/resourceGroups/g1/providers/Microsoft.Network/virtualNetworks/vnet2/subnets/subnet2"

This command remove several VirtualNetworkRules with VirtualNetworkResourceID.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultProfile

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

Type:Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-IpAddressOrRange

Cognitive Services Account NetworkRule IpRules IpAddressOrRange in string.

Type:System.String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-IpRule

Cognitive Services Account NetworkRule IpRules.

Type:Microsoft.Azure.Commands.Management.CognitiveServices.Models.PSIpRule[]
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-Name

Cognitive Services Account Name.

Type:String
Aliases:CognitiveServicesAccountName, AccountName
Position:1
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-ResourceGroupName

Resource Group Name.

Type:String
Position:0
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-VirtualNetworkResourceId

Cognitive Services Account NetworkRule VirtualNetworkRules VirtualNetworkResourceId in string.

Type:System.String[]
Aliases:SubnetId, VirtualNetworkId
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-VirtualNetworkRule

Cognitive Services Account NetworkRule VirtualNetworkRules.

Type:Microsoft.Azure.Commands.Management.CognitiveServices.Models.PSVirtualNetworkRule[]
Position:Named
Default value:None
Accept pipeline input:True (ByValue)
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Microsoft.Azure.Commands.Management.CognitiveServices.Models.PSIpRule[]

Microsoft.Azure.Commands.Management.CognitiveServices.Models.PSVirtualNetworkRule[]

Outputs

Microsoft.Azure.Commands.Management.CognitiveServices.Models.PSVirtualNetworkRule

Microsoft.Azure.Commands.Management.CognitiveServices.Models.PSIpRule