使用Azure Resource Manager自动执行AD

时间:2016-09-29 12:30:19

标签: azure active-directory azure-resource-manager

我尝试通过以下链接自动化AD:

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] + ...  'asrsnraju@hotmail.com' -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.

我尝试过使用可用的模板,但我遇到了问题。已成功部署,但角色不可见。只有组策略管理可见,而不是全部。所以,我跟着这个。

这是我面临的错误:

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

然后,我已经对我的powershell做了这个尝试解决它。但没有改变:

keptFeatures

我需要在powershell中添加一些内容吗?

1 个答案:

答案 0 :(得分:0)

因此,对于遇到此问题的其他人,我在尝试Azure快速入门时遇到了同样的问题,这是因为我没有安装Azure PowerShell cmdlet。步骤详细here并且是:

  1. 确保安装了PowerShellGet,需要Powershell 5.x,如果版本较低,则需要PackageManagement modules

  2. 安装Azure PowerShell工具(在提升的PowerShell窗口中):

    安装模块AzureRM

  3. 确保重新启动Visual Studio,然后重试Azure脚本