< Back

Rename-AzureRmContext

Tue Jan 29, 2019 10:00 pm

NAME Rename-AzureRmContext



SYNOPSIS

Rename an Azure context. By default contexts are named by user account and subscription.





SYNTAX

Rename-AzureRmContext [-TargetName] <String> [-DefaultProfile <IAzureContextContainer>] [-Force] -InputObject <PSAzureContext> [-PassThru] [-Scope

{Process | CurrentUser}] [-Confirm] [-WhatIf] [<CommonParameters>]



Rename-AzureRmContext [-SourceName] <String> [-TargetName] <String> [-DefaultProfile <IAzureContextContainer>] [-Force] [-PassThru] [-Scope

{Process | CurrentUser}] [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

Rename an Azure context. By default contexts are named by user account and subscription.





PARAMETERS

-DefaultProfile <IAzureContextContainer>

The credentials, tenant and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Force [<SwitchParameter>]

Rename the context even if the target context already exists



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-InputObject <PSAzureContext>

A context object, normally passed through the pipeline.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-PassThru [<SwitchParameter>]

Return the renamed context.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Scope <ContextModificationScope>

Determines the scope of context changes, for example, whether changes apply only to the current process, or to all sessions started by this

user



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-SourceName <String>

The name of the context



Required? true

Position? 0

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-TargetName <String>

The new name of the context



Required? true

Position? 1

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None







OUTPUTS

Microsoft.Azure.Commands.Profile.Models.PSAzureContext







NOTES









Rename a context using named parameters



PS C:\\> Rename-AzureRmContext -SourceName "[user1@contoso.org; 12345-6789-2345-3567890]" -TargetName "Work"



Rename the context for 'user1@contoso.org' with subscription '12345-6789-2345-3567890' to 'Work'. After this command, you will be able to target

the context using 'Select-AzureRmContext Work'. Note that you can tab through the values for 'SourceName' using tab completion.





Rename a context using positional parameters



PS C:\\> Rename-AzureRmContext "My context" "Work"



Rename the context named "My context" to "Work". After this command, you will be able to target the context using Select-AzureRmContext Work







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... ermcontext