Get-AzContext
Gets the metadata used to authenticate Azure Resource Manager requests.
Get-AzContext
[-DefaultProfile <IAzureContextContainer>]
[[-Name] <String>]
[<CommonParameters>]
Get-AzContext
[-ListAvailable]
[-RefreshContextFromTokenCache]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
The Get-AzContext cmdlet gets the current metadata used to authenticate Azure Resource Manager requests.
This cmdlet gets the Active Directory account, Active Directory tenant, Azure subscription, and the targeted Azure environment.
Azure Resource Manager cmdlets use these settings by default when making Azure Resource Manager requests. When the available amount of subscription exceeds the default limit of 25, some subscriptions may not show up in the results of Get-AzContext -ListAvailable
. Please run Connect-AzAccount -MaxContextPopulation <int>
to get more contexts.
Connect-AzAccount
Get-AzContext
Name Account SubscriptionName Environment TenantId
---- ------- ---------------- ----------- --------
Subscription1 (xxxxxxxx-xxxx-xxxx-xxx... test@outlook.com Subscription1 AzureCloud xxxxxxxx-x...
In this example we are logging into our account with an Azure subscription using Connect-AzAccount, and then we are getting the context of the current session by calling Get-AzContext.
Get-AzContext -ListAvailable
Name Account SubscriptionName Environment TenantId
---- ------- ---------------- ----------- --------
Subscription1 (xxxxxxxx-xxxx-xxxx-xxx... test@outlook.com Subscription1 AzureCloud xxxxxxxx-x...
Subscription2 (xxxxxxxx-xxxx-xxxx-xxx... test@outlook.com Subscription2 AzureCloud xxxxxxxx-x...
Subscription3 (xxxxxxxx-xxxx-xxxx-xxx... test@outlook.com Subscription3 AzureCloud xxxxxxxx-x...
In this example, all currently available contexts are displayed. The user may select one of these contexts using Select-AzContext.
The credentials, account, tenant and subscription used for communication with azure
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
List all available contexts in the current session.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The name of the context
Type: | String |
Position: | 0 |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Refresh contexts from token cache
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
None
Commentaires sur Azure PowerShell
Azure PowerShell est un projet open source. Sélectionnez un lien pour fournir des commentaires :