什麼是 Azure PowerShell?
Azure PowerShell 是一組 Cmdlet,可讓您使用 PowerShell 直接管理 Azure 資源。 2018 年 12 月,Az PowerShell 模組正式推出。 現在是與 Azure 互動的建議 PowerShell 模組。 若要深入瞭解 Az PowerShell 模組,請參閱 Az PowerShell 模組簡介。
如何? 停用 Azure PowerShell 中的重大變更警告訊息?
若要隱藏 Azure PowerShell 中的重大變更警告訊息,您必須將環境變數 SuppressAzurePowerShellBreakingChangeWarnings
設定為 true
。
Set-Item -Path Env:\SuppressAzurePowerShellBreakingChangeWarnings -Value $true
如何? 停用 Azure PowerShell 中的 AzureRM 淘汰警告訊息?
若要在 Azure PowerShell 中隱藏 AzureRM 淘汰警告訊息,您必須將環境變數 SuppressAzureRmModulesRetiringWarning
設定為 true
。
Set-Item -Path Env:\SuppressAzureRmModulesRetiringWarning -Value $true
上述範例的其中一個缺點是,除非您將它新增至PowerShell配置檔,否則您必須針對每個新的PowerShell會話執行命令。
若要永久設定環境變數,您也可以使用下列範例。
[System.Environment]::SetEnvironmentVariable('SuppressAzureRmModulesRetiringWarning', 'true', [System.EnvironmentVariableTarget]::User)
如何? 判斷 Azure PowerShell 中的 HTTP 重試次數上限?
針對一般 HTTP 回應(回應狀態代碼為 429 除外),Azure PowerShell 會使用環境變數中 AZURE_PS_HTTP_MAX_RETRIES
定義的值。 其最小值為 0。 如果未指定,Azure PowerShell 會使用 SDK 預設值。
[System.Environment]::SetEnvironmentVariable('AZURE_PS_HTTP_MAX_RETRIES ', 3, [System.EnvironmentVariableTarget]::User)
如果 HTTP 回應狀態代碼為 429,Azure PowerShell 會使用環境變數中 AZURE_PS_HTTP_MAX_RETRIES_FOR_429
定義的值。 其最小值為 1。 狀態代碼 429 的總重試時間是 (AZURE_PS_HTTP_MAX_RETRIES
+ 1) * AZURE_PS_HTTP_MAX_RETRIES_FOR_429
- 1。 如果未指定,Azure PowerShell 會使用 SDK 預設值。
[System.Environment]::SetEnvironmentVariable('AZURE_PS_HTTP_MAX_RETRIES_FOR_429 ', 3, [System.EnvironmentVariableTarget]::User)