2017-04-12 10 views
0

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. 

私は何かを得ることができませんこの時点までに実行する本当にイライラしています。助けをよろしく!

+0

コマンドを個別に実行する場合、これはPowerShellで機能しますか?使用しているAzureRMのバージョンを確認できますか? – CtrlDot

+0

新しいAzure CLI 2.0ではサポートされていない機能はありますか? https://docs.microsoft.com/en-us/cli/azure/install-azure-cli - 私はこれをOS X、Powershell、そしてDockerコンテナで成功しています。 – Digicoder

答えて

0

あなたの説明によると、我々はいくつかのチェックを行う必要があります。このコマンドを見つけることが

1.Run Get-Command Test-AzureRmDnsAvailabilityを:

PS C:\Users> Get-Command Test-AzureRmDnsAvailability 

CommandType  Name            Version Source 
-----------  ----            ------- ------ 
Cmdlet   Test-AzureRmDnsAvailability      3.3.0  AzureRM.Network 

2.Run Get-Module -ListAvailable -Name Azure -Refresh私AzureのPowerShellのバージョン、AzureのPowerShellのバージョンを確認します3.3.0で、私はこのスクリプトを実行することができる午前:

PS C:\Users> Get-Module -ListAvailable -Name Azure -Refresh 


    Directory: C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ServiceManagement 


ModuleType Version Name        ExportedCommands 
---------- ------- ----        ---------------- 
Manifest 3.3.0  Azure        {Get-AzureAutomationCertificate, Get-AzureAutomationConnection, New-AzureAutomationConnection, Remove-AzureAutomationConnection...} 

テストのために、我々は別途Test-AzureRmDnsAvailabilityを実行する必要があります。

今のところ、最新のリリースバージョンは3.8.0です。Azure PowerShellの詳細については、linkを参照してください。

+0

私に教えてくださいさらなる支援が必要かどうかを知ってください。 –

+0

Azure PowerShellのインストールファイルをダウンロードし、ローカルPCにインストールすることもできます。 https://github.com/Azure/azure-powershell/releases/download/v3.7.0-March2017/azure-powershell.3.7.0.msi –

関連する問題