我一直在運行一個相對簡單的腳本來登錄到Azure(我得到一個交互式窗口),當我運行一個檢查以查看名稱是否可用時,我提示再次登錄:繼續提示通過Powershell登錄Azure
# Install the Azure Resource Manager modules from PowerShell Gallery
# Takes a while to install 28 modules
Install-Module AzureRM -Force -Verbose
Install-AzureRM
# Install the Azure Service Management module from PowerShell Gallery
Install-Module Azure -Force -Verbose
# Import AzureRM modules for the given version manifest in the AzureRM module
Import-AzureRM -Verbose
# Import Azure Service Management module
Import-Module Azure -Verbose
# Authenticate to your Azure account
Login-AzureRmAccount -SubscriptionId 'xxxxxxxx'
# Adjust the 'yournamehere' part of these three strings to
# something unique for you. Leave the last two characters in each.
$URI = 'https://someurlhere.com/azuredeploy.json'
$Location = 'east us'
$rgname = 'yournamehererg'
$saname = 'yournameheresa' # Lowercase required
$addnsName = 'yournameheread' # Lowercase required
# Check that the public dns $addnsName is available
if (Test-AzureRmDnsAvailability -DomainNameLabel $addnsName -Location $Location)
{ 'Available' } else { 'Taken. addnsName must be globally unique.' }
最初登錄的作品,展示了我的訂閱,但是當我執行最後命令我得到:
Test-AzureRmDnsAvailability : Run Login-AzureRmAccount to login.
我不能得到任何東西在過去這一點上執行。這真是令人沮喪。感謝任何幫助!
這是否在PowerShell中運行,如果你要單獨運行命令?你能確認你使用的AzureRM版本嗎? – CtrlDot
是否有任何需要做的事情不受新的Azure CLI 2.0支持? https://docs.microsoft.com/en-us/cli/azure/install-azure-cli - 我一直在OS X,Powershell和Docker容器上使用它,取得了一些成功 – Digicoder