由於沒有指定安裝的Azure PowerShell模塊的版本,因此我會首先建議確保您具有最新版本,這些版本可在http://aka.ms/webpi-azps處獲得。
管理這些多環境前進(新方法)的方式是使用Azure配置文件。例如(使用虛擬名稱),
# Create a profile
Login-AzureRmAccount -SubscriptionId "[subscription id (GUID)]" -TenantId "adatum.onmicrosoft.com"
Save-AzureRmProfile -Path "C:\adatum" # Use a name meaningful to you.
# Create another profile
Login-AzureRmAccount -SubscriptionId "[subscription id (GUID)]" -TenantId "contoso.com"
Save-AzureRmProfile -Path "C:\contoso" # Use a name meaningful to you.
# Create another profile
Login-AzureRmAccount -SubscriptionId "[subscription id (GUID)]" -TenantId "fabrikam.com"
Save-AzureRmProfile -Path "C:\fabrikam" # Use a name meaningful to you.
然後,選擇要用於會話的配置文件。例如,
Select-AzureRmProfile -Path "C:\contoso"
# Do work (invoke commands) on the Contoso tenant.
Select-AzureRmProfile -Path "C:\adatum"
# Do work (invoke commands) on the Adatum tenant.
等等...