【发布时间】:2018-06-16 21:38:29
【问题描述】:
我正在使用 ARM 并创建了一个自动化帐户,其中包含一个运行手册,使用下面的 PowerShell 代码 sn-p 来修改 Azure AD 用户,以便正确更新他们的位置。所有资源都与我的 Azure AD 位于同一订阅和资源组中。
获取-msoluser |其中{$_.userPrincipalName -like "*@contoso.co.uk"} |设置 msoluser -Usagelocation "GB" 当我在 Azure 中运行它时,出现如下错误:
术语“get-msoluser”未被识别为 cmdlet、函数、脚本文件或可操作的名称 程序。检查名称的拼写,或者如果包含路径,请验证路径是否正确并重试。 在行:2 字符:1 + 获取 msoluser |其中{$_.userPrincipalName -like "*@contoso.co.uk."} |小... +~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (get-msoluser:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
当我使用“connect-msolservice”手动运行 PowerShell 并输入我的凭据时,它工作正常。
我有几个问题:
- 我是否需要提供凭据以便 PowerShell 知道要连接到哪个 Azure AD?
- 我需要进行哪些修改才能确保 get-msoluser cmdlet 被识别?
谢谢
【问题讨论】:
-
这个blog 回答了你的问题。请看我的回答。
标签: azure automation