Remove-AzureEnvironment

Deletes an Azure environment from Windows PowerShell.

Note

The cmdlets referenced in this documentation are for managing legacy Azure resources that use Azure Service Manager (ASM) APIs. This legacy PowerShell module isn't recommended when creating new resources since ASM is scheduled for retirement. For more information, see Azure Service Manager retirement.

The Az PowerShell module is the recommended PowerShell module for managing Azure Resource Manager (ARM) resources with PowerShell.

Syntax

Remove-AzureEnvironment
      -Name <String>
      [-Force]
      [-Profile <AzureSMProfile>]
      [<CommonParameters>]

Description

The Remove-AzureEnvironment cmdlet deletes an Azure environment from your roaming profile so Windows PowerShell can't find it. This cmdlet does not delete the environment from Microsoft Azure, or change the actual environment in any way.

An Azure environment an independent deployment of Microsoft Azure, such as AzureCloud for global Azure and AzureChinaCloud for Azure operated by 21Vianet in China. You can also create on-premises Azure environments by using Azure Pack and the WAPack cmdlets. For more information, see Azure Pack.

Examples

Example 1: Delete an environment

PS C:\> Remove-AzureEnvironment -Name ContosoEnv

This command deletes the ContosoEnv environment from Windows PowerShell.

Example 2: Delete multiple environments

PS C:\> Get-AzureEnvironment | Where-Object EnvironmentName -like "Contoso*" | ForEach-Object {Remove-AzureEnvironment -Name $_.EnvironmentName }

This command deletes environments whose names begin with "Contoso" from Windows PowerShell.

Parameters

-Force

Suppresses the confirmation prompt.

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

-Name

Specifies the name of the environment to remove. This parameter is required. This parameter value is case-sensitive. Wildcard characters are not permitted.

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

-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

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

Inputs

None

You can pipe input to this cmdlet by property name, but not by value.

Outputs

None or System.Boolean

If you use the PassThru parameter, this cmdlet returns a Boolean value. Otherwise, it does not return any output.