2016-09-29 233 views
0

自動化AD我試圖通過以下鏈接自動AD:使用Azure的資源管理器

https://blogs.technet.microsoft.com/markrenoden/2016/07/26/deploying-a-dc-to-azure-iaas-with-arm-and-dsc/ 

我已經使用了可用模板嘗試,但我有一個問題存在。部署成功,但角色不可見。只有組策略管理是可見的,並非全部。所以,我正在關注這一點。

這是我面對的錯誤:

16:17:11 - [ERROR] Get-AzureRmEnvironment : The term 'Get-AzureRmEnvironment' is not recognized 
16:17:11 - [ERROR] as the name of a cmdlet, function, script file, or operable program. Check the 
16:17:11 - [ERROR] spelling of the name, or if a path was included, verify that the path is 
16:17:11 - [ERROR] correct and try again. 
16:17:11 - [ERROR] At line:1 char:171 
16:17:11 - [ERROR] + ... re_PS_Data_Collection = 'true' }; if ((Get-AzureRmEnvironment -Name ' ... 
16:17:11 - [ERROR] +           ~~~~~~~~~~~~~~~~~~~~~~ 
16:17:11 - [ERROR]  + CategoryInfo   : ObjectNotFound: (Get-AzureRmEnvironment:String) 
16:17:11 - [ERROR] [], CommandNotFoundException 
16:17:11 - [ERROR]  + FullyQualifiedErrorId : CommandNotFoundException 
16:17:11 - [ERROR] 
16:17:11 - [ERROR] Get-AzureRmEnvironment : The term 'Get-AzureRmEnvironment' is not recognized 
16:17:11 - [ERROR] as the name of a cmdlet, function, script file, or operable program. Check the 
16:17:11 - [ERROR] spelling of the name, or if a path was included, verify that the path is 
16:17:11 - [ERROR] correct and try again. 
16:17:11 - [ERROR] At line:1 char:2323 
16:17:11 - [ERROR] + ... '[email protected]' -Environment (Get-AzureRmEnvironment -Name ' ... 
16:17:11 - [ERROR] +           ~~~~~~~~~~~~~~~~~~~~~~ 
16:17:11 - [ERROR]  + CategoryInfo   : ObjectNotFound: (Get-AzureRmEnvironment:String) 
16:17:11 - [ERROR] [], CommandNotFoundException 
16:17:11 - [ERROR]  + FullyQualifiedErrorId : CommandNotFoundException 
16:17:11 - [ERROR] 
16:17:11 - [ERROR] & : The script 'Deploy-AzureResourceGroup.ps1' cannot be run because the 
16:17:11 - [ERROR] following modules that are specified by the "#requires" statements of the 
16:17:11 - [ERROR] script are missing: AzureRM.Resources. 
16:17:11 - [ERROR] At line:1 char:2369 
16:17:11 - [ERROR] + ... eCloud')));&'C:\Users\admin\Documents\Visual Studio 2015\Projects\MyD ... 
16:17:11 - [ERROR] +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
16:17:11 - [ERROR]  + CategoryInfo   : ResourceUnavailable: (Deploy-AzureResourceGroup. 
16:17:11 - [ERROR] ps1:String) [], ScriptRequiresException 
16:17:11 - [ERROR]  + FullyQualifiedErrorId : ScriptRequiresMissingModules 
16:17:11 - [ERROR] 
16:17:11 - 
16:17:11 - Deploying template using PowerShell script failed. 

然後,我已經這樣做了我的PowerShell來嘗試解決這個問題。但沒有任何改變:

Add-AzureRmAccount -Environment (Get-AzureRmEnvironment -Name AzureUSGovernment) 

我需要添加一些東西到我的PowerShell?

+0

您運行的是哪個版本的Azure PowerShell? –

+0

PS C:\ Users \ admin> $ PSVersionTable.PSVersion。這是我用來檢查版本的命令。它返回了Major-5,Minor --- 1,Build --- 14393,Revision --- 187 – prudhvi

+0

在powershell ISE中,我可以在右邊找到Get-AzureRmEnvironment模塊。所以,這意味着我有這個模塊。那麼,爲什麼錯誤?在上面的命令中,我將其命名爲AzureUSGovernment,並且正在東南亞部署我的部署。我可以這樣做嗎? – prudhvi

回答

0

因此,對於任何遇到此問題的人,我嘗試嘗試使用Azure快速入門時遇到了同樣的問題,這是因爲我沒有安裝Azure PowerShell cmdlet。詳細步驟here和有:

  1. 確保您已安裝PowerShellGet,需要PowerShell的5.x的,如果在一個較低的版本,你需要的PackageManagement modules

  2. 安裝在Azure的PowerShell工具(從內提升PowerShell窗口):

    安裝,模塊AzureRM

  3. 確保重新啓動Visual Studio,然後重試Azure的腳本