< Back

Import-AzureRmContext

Tue Jan 29, 2019 10:00 pm

NAME Import-AzureRmContext



SYNOPSIS

Loads Azure authentication information from a file.





SYNTAX

Import-AzureRmContext [-AzureContext] <AzureRmProfile> [-DefaultProfile <IAzureContextContainer>] [-Scope {Process | CurrentUser}] [-Confirm]

[-WhatIf] [<CommonParameters>]



Import-AzureRmContext [-Path] <String> [-DefaultProfile <IAzureContextContainer>] [-Scope {Process | CurrentUser}] [-Confirm] [-WhatIf]

[<CommonParameters>]





DESCRIPTION

The Import-AzureRmContext cmdlet loads authentication information from a file to set the Azure environment and context. Cmdlets that you run in

the current session use this information to authenticate requests to Azure Resource Manager.





PARAMETERS

-AzureContext <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? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-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



-Path <String>

Specifies the path to context information saved by using Save-AzureRMContext.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

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



-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

Contains the set of credentials, accounts, and subscriptions that are used to communicate with Azure.





OUTPUTS

Microsoft.Azure.Commands.Profile.Models.PSAzureProfile

Contains the set of credentials, accounts, and subscriptions that can be used to communicate with Azure.





NOTES









Example 1: Importing a context from a AzureRmProfile



PS C:\\> Import-AzureRmContext -AzureContext (Connect-AzureRmAccount)



Environment : AzureCloud

Account : test@outlook.com

TenantId : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

SubscriptionId : yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy

SubscriptionName : Test Subscription

CurrentStorageAccount :



This example imports a context from a PSAzureProfile that is passed through to the cmdlet.





Example 2: Importing a context from a JSON file



PS C:\\> Import-AzureRmContext -Path C:\\test.json



Environment : AzureCloud

Account : test@outlook.com

TenantId : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

SubscriptionId : yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy

SubscriptionName : Test Subscription

CurrentStorageAccount :



This example selects a context from a JSON file that is passed through to the cmdlet. This JSON file can be created from Save-AzureRmContext.







RELATED LINKS

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