Skip to content

Latest commit

 

History

History
162 lines (123 loc) · 3.7 KB

Save-AzContext.md

File metadata and controls

162 lines (123 loc) · 3.7 KB
external help file Module Name online version schema
Microsoft.Azure.PowerShell.Cmdlets.Accounts.dll-Help.xml
Az.Accounts
2.0.0

Save-AzContext

SYNOPSIS

Saves the current authentication information for use in other PowerShell sessions.

SYNTAX

Save-AzContext [[-Profile] <AzureRmProfile>] [-Path] <String> [-Force] [-WithCredential]
 [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

The Save-AzContext cmdlet saves the current authentication information for use in other PowerShell sessions.

EXAMPLES

Example 1: Saving the current session's context

Connect-AzAccount
Save-AzContext -Path C:\test.json

This example saves the current session's Azure context to the JSON file provided.

Example 2: Saving a given context

Save-AzContext -Profile (Connect-AzAccount) -Path C:\test.json

This example saves the Azure context that is passed through to the cmdlet to the JSON file provided.

PARAMETERS

-DefaultProfile

The credentials, tenant, and subscription used for communication with azure.

Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer
Parameter Sets: (All)
Aliases: AzContext, AzureRmContext, AzureCredential

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

-Force

Overwrite the given file if it exists

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Path

Specifies the path of the file to which to save authentication information.

Type: System.String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Profile

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

Type: Microsoft.Azure.Commands.Common.Authentication.Models.AzureRmProfile
Parameter Sets: (All)
Aliases:

Required: False
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-WithCredential

Export the credentials to the file

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

-WhatIf

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

Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases: wi

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

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Microsoft.Azure.Commands.Common.Authentication.Models.AzureRmProfile

OUTPUTS

Microsoft.Azure.Commands.Profile.Models.Core.PSAzureProfile

NOTES

RELATED LINKS