< Back
Save-AzureRmContext
Post
NAME Save-AzureRmContext
SYNOPSIS
Saves the current authentication information for use in other PowerShell sessions.
SYNTAX
Save-AzureRmContext [[-Profile] <AzureRmProfile>] [-Path] <String> [-DefaultProfile <IAzureContextContainer>] [-Force] [-Confirm] [-WhatIf]
[<CommonParameters>]
DESCRIPTION
The Save-AzureRmContext cmdlet saves the current authentication information for use in other PowerShell sessions.
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>]
Overwrite the given file if it exists
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Path <String>
Specifies the path of the file to which to save authentication information.
Required? true
Position? 1
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Profile <AzureRmProfile>
Specifies the Azure context from which this cmdlet reads. If you do not specify a context, this cmdlet reads from the local default context.
Required? false
Position? 0
Default value None
Accept pipeline input? True (ByValue)
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
Microsoft.Azure.Commands.Common.Authentication.Models.AzureRMProfile
OUTPUTS
Microsoft.Azure.Commands.Profile.Models.PSAzureProfile
NOTES
Example 1: Saving the current session's context
PS C:\\> Connect-AzureRmAccount
PS C:\\> Save-AzureRmContext -Path C:\\test.json
This example saves the current session's Azure context to the JSON file provided.
Example 2: Saving a given context
PS C:\\> Save-AzureRmContext -Profile (Connect-AzureRmAccount) -Path C:\\test.json
This example saves the Azure context that is passed through to the cmdlet to the JSON file provided.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... ermcontext
SYNOPSIS
Saves the current authentication information for use in other PowerShell sessions.
SYNTAX
Save-AzureRmContext [[-Profile] <AzureRmProfile>] [-Path] <String> [-DefaultProfile <IAzureContextContainer>] [-Force] [-Confirm] [-WhatIf]
[<CommonParameters>]
DESCRIPTION
The Save-AzureRmContext cmdlet saves the current authentication information for use in other PowerShell sessions.
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>]
Overwrite the given file if it exists
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Path <String>
Specifies the path of the file to which to save authentication information.
Required? true
Position? 1
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Profile <AzureRmProfile>
Specifies the Azure context from which this cmdlet reads. If you do not specify a context, this cmdlet reads from the local default context.
Required? false
Position? 0
Default value None
Accept pipeline input? True (ByValue)
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
Microsoft.Azure.Commands.Common.Authentication.Models.AzureRMProfile
OUTPUTS
Microsoft.Azure.Commands.Profile.Models.PSAzureProfile
NOTES
Example 1: Saving the current session's context
PS C:\\> Connect-AzureRmAccount
PS C:\\> Save-AzureRmContext -Path C:\\test.json
This example saves the current session's Azure context to the JSON file provided.
Example 2: Saving a given context
PS C:\\> Save-AzureRmContext -Profile (Connect-AzureRmAccount) -Path C:\\test.json
This example saves the Azure context that is passed through to the cmdlet to the JSON file provided.
RELATED LINKS
Online Version: https://docs.microsoft.com/en-us/powers ... ermcontext