2016-09-29 110 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的脚本