Enable-AzContextAutosave
Azure 內容是 PowerShell 物件,代表您用來執行命令的作用中訂用帳戶,以及連線至 Azure 雲端所需的驗證資訊。 使用 Azure 內容時,Azure PowerShell 不需要在每次切換訂用帳戶時重新驗證您的帳戶。 如需詳細資訊,請參閱 Azure PowerShell 內容物件 。
此 Cmdlet 可讓您在啟動 PowerShell 程式時儲存並自動載入 Azure 內容資訊。 例如,開啟新視窗時。
Syntax
Enable-AzContextAutosave
[-Scope <ContextModificationScope>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
允許在 PowerShell 程式啟動時儲存並自動載入 Azure 內容資訊。 內容會在影響內容的任何 Cmdlet 執行結束時儲存。 例如,任何設定檔 Cmdlet。 如果您使用使用者驗證,則在執行任何 Cmdlet 的過程中,可以更新權杖。
範例
範例 1:啟用目前使用者的自動儲存認證
開啟目前使用者的認證自動儲存。 每當開啟 PowerShell 視窗時,就會記住您目前的內容,而不會登入。
Enable-AzContextAutosave
範例 2
當您在此 PowerShell 會話中開啟 PowerShell 視窗時,允許儲存並自動載入 Azure 認證、帳戶和訂用帳戶資訊。 (自動產生)
Enable-AzContextAutosave -Scope Process
參數
-Confirm
執行 Cmdlet 之前先提示您確認。
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-DefaultProfile
用於與 Azure 通訊的認證、租使用者和訂用帳戶
Type: | IAzureContextContainer |
Aliases: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Scope
決定內容變更的範圍。 例如,變更僅適用于目前進程,或套用至此使用者啟動的所有會話。 對範圍 CurrentUser
所做的變更會影響使用者啟動的所有 PowerShell 會話。 如果特定會話需要有不同的設定,請使用範圍 Process
。
Type: | ContextModificationScope |
Accepted values: | Process, CurrentUser |
Position: | Named |
Default value: | CurrentUser |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-WhatIf
顯示執行 Cmdlet 後會發生的情況。 Cmdlet 未執行。
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
輸入
None