我一直在运行一个相对简单的脚本来登录到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