Share via


Remove-SubnetInjectionEnterprisePolicy

Removes a subnet injection enterprise policy for Power Platform.

Syntax

ByResourceId (Default)

Remove-SubnetInjectionEnterprisePolicy
    -PolicyResourceId <String>
    [-TenantId <String>]
    [-AzureEnvironment <AzureEnvironment>]
    [-ForceAuth]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

ByResourceGroup

Remove-SubnetInjectionEnterprisePolicy
    -SubscriptionId <String>
    -ResourceGroupName <String>
    [-TenantId <String>]
    [-AzureEnvironment <AzureEnvironment>]
    [-ForceAuth]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

BySubscription

Remove-SubnetInjectionEnterprisePolicy
    -SubscriptionId <String>
    [-TenantId <String>]
    [-AzureEnvironment <AzureEnvironment>]
    [-ForceAuth]
    [-Force]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

The Remove-SubnetInjectionEnterprisePolicy cmdlet removes a subnet injection enterprise policy using one of three methods:

  • By Resource ID: Removes a specific policy using its Azure Resource Manager (ARM) resource ID.
  • By Subscription: Lists all subnet injection policies in a subscription (use -PolicyResourceId to remove a specific policy).
  • By Resource Group: Lists all subnet injection policies in a resource group (use -PolicyResourceId to remove a specific policy).

When using BySubscription or ByResourceGroup, if multiple policies are found, the cmdlet outputs the policy ARM IDs. You can specify which policy to remove using -PolicyResourceId.

Note: A policy can't be deleted if it's associated with any Power Platform environments. Unlink the policy from all environments before attempting to remove it.

Examples

EXAMPLE 1

Remove-SubnetInjectionEnterprisePolicy -PolicyResourceId "/subscriptions/12345678-1234-1234-1234-123456789012/resourceGroups/myResourceGroup/providers/Microsoft.PowerPlatform/enterprisePolicies/myPolicy"

Removes the specified subnet injection enterprise policy by its ARM resource ID.

EXAMPLE 2

Remove-SubnetInjectionEnterprisePolicy -SubscriptionId "12345678-1234-1234-1234-123456789012"

Lists all subnet injection enterprise policies in the subscription. When only one policy exists, it's removed. If multiple policies exist, the ARM IDs are returned as output so you can specify which one to remove.

EXAMPLE 3

Remove-SubnetInjectionEnterprisePolicy -SubscriptionId "12345678-1234-1234-1234-123456789012" -ResourceGroupName "myResourceGroup"

Lists all subnet injection enterprise policies in the resource group. When only one policy exists, it's removed. If multiple policies exist, their ARM IDs are returned as output so you can specify which one to remove.

EXAMPLE 4

Remove-SubnetInjectionEnterprisePolicy -PolicyResourceId "/subscriptions/.../enterprisePolicies/myPolicy" -AzureEnvironment AzureUSGovernment

Removes the specified policy in the Azure US Government cloud.

EXAMPLE 5

Remove-SubnetInjectionEnterprisePolicy -PolicyResourceId "/subscriptions/.../enterprisePolicies/myPolicy" -Force

Removes the specified policy without prompting for confirmation.

Parameters

-AzureEnvironment

The Azure environment to connect to

Parameter properties

Type:AzureEnvironment
Default value:AzureCloud
Accepted values:AzureCloud, AzureChinaCloud, AzureUSGovernment, EastUs2Euap, CentralUSEuap
Supports wildcards:False
DontShow:False

Parameter sets

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

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

-Force

Remove the policy without prompting for confirmation

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

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

-ForceAuth

Force re-authentication instead of reusing existing session

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False

Parameter sets

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

-PolicyResourceId

The full Azure ARM resource ID of the enterprise policy

Parameter properties

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

Parameter sets

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

-ResourceGroupName

The Azure resource group name to search for policies

Parameter properties

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

Parameter sets

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

-SubscriptionId

The Azure subscription ID containing the resource group

Parameter properties

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

Parameter sets

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

-TenantId

The Azure AD tenant ID

Parameter properties

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

Parameter sets

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

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
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.

Outputs

None

Returns nothing on success. Throws an error if no policy is found or removal fails.

When multiple policies are found, outputs the policy ARM IDs.