編集

次の方法で共有


Remove-AzDelegation

Removes a service delegation from the provided subnet.

Syntax

Remove-AzDelegation
      -Name <String>
      -Subnet <PSSubnet>
      [-DefaultProfile <IAzureContextContainer>]
      [<CommonParameters>]

Description

The Remove-AzDelegation cmdlet takes in a Subnet with delegations and removes the named delegation from that subnet.

Examples

Example 1

# Add a delegation to an existing subnet
$vnet = Get-AzVirtualNetwork -Name "myVNet" -ResourceGroupName "myResourceGroup"
$subnet = Get-AzVirtualNetworkSubnetConfig -Name "mySubnet" -VirtualNetwork $vnet
$subnet = Add-AzDelegation -Name "myDelegation" -ServiceName "Microsoft.Sql/servers" -Subnet $subnet
Set-AzVirtualNetwork -VirtualNetwork $vnet

# Remove the delegation
$vnet = Get-AzVirtualNetwork -Name "myVNet" -ResourceGroupName "myResourceGroup"
$subnet = Get-AzVirtualNetworkSubnetConfig -Name "mySubnet" -VirtualNetwork $vnet
$subnet = Remove-AzDelegation -Name "myDelegation" -Subnet $subnet
Set-AzVirtualNetwork -VirtualNetwork $vnet

In this example, the first half (found under "Add a delegation to an existing subnet") is identical to Add-AzDelegation. In the second half, the first two cmdlets retrieve the subnet of interest, refreshing the local copy with what's on the server. The third cmdlet removes the delegation that was created in the first half from mySubnet and stores the updated subnet in $subnet. The final cmdlet updates the server with the removed delegation.

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

-Name

The name of the delegation

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

-Subnet

The subnet from which to remove the delegation

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

Inputs

String

PSSubnet

Outputs

PSSubnet