【问题标题】:Creation of new AzureAD application with powershell使用 powershell 创建新的 AzureAD 应用程序
【发布时间】:2017-10-31 13:58:27
【问题描述】:

我正在尝试使用 Azure Active Directory Powershell 2.0 模块创建一个新的 AzureAD 应用程序,但是在调用 New- AzureADApplication 我收到 HTTP Bad requset 并出现以下错误。

+ New-AzureADApplication -DisplayName "Umbraco-domea" -IdentifierUris $ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [New-AzureADApplication], ApiException
+ FullyQualifiedErrorId : Microsoft.Open.AzureAD16.Client.ApiException,Microsoft.Open.AzureAD16.PowerShell.NewApplication

我通过谷歌搜索发现了以下 github 问题,但是即使在我的 cmdlet 调用中包含 -IdentifierUris,我仍然会收到错误消息。

New-AzureADApplication -DisplayName $displayName -IdentifierUris $URIs -GroupMembershipClaims "SecurityGroup" -ReplyUrls @($Live",$Dev,"http://localhost:4198/")

【问题讨论】:

  • 尝试包含 -Debug 标志,您可能会在那里看到确切的错误。
  • 不会对错误的输出产生影响:/
  • 嗯,您也可以尝试使用 Fiddler 检查流量。
  • 这是我使用的一个示例:github.com/Azure-Samples/powerbi-powershell/blob/master/… 它专门用于 PowerBI,因此可能无法直接应用,但请注意它使用 native 应用程序,因为 powershell 是一个客户端应用程序,并且另请注意,重定向 URI 是 urn:ietf:wg:oauth:2.0:oob。这可能是一个完整的红鲱鱼,或者它可能会给你其他地方看看

标签: powershell azure powershell-2.0 azure-active-directory azure-ad-powershell-v2


【解决方案1】:

以下脚本对我有用,也许你可以测试一下。

$displayName="shuitest"
$URIs="http://mynewapp.contoso.com"
$Live="https://localhost:8080"
$Dev="https://localhost:8081"
New-AzureADApplication -DisplayName $displayName -IdentifierUris $URIs -GroupMembershipClaims "SecurityGroup" -ReplyUrls @($Live,$Dev,"http://localhost:4198/")

如果您也收到相同的错误日志,请开始您的脚本添加 $DebugPreference="Continue" 以生成额外的调试信息。

【讨论】:

  • 今天不上班,不过我明天去看看。已经谢谢沃尔特了!
  • 这对我有用。问题在于我如何传递 URI。官方文档说 URI 需要作为列表传递,但是仅传递字符串就可以使其工作。
猜你喜欢
  • 2019-02-12
  • 1970-01-01
  • 2010-09-20
  • 1970-01-01
  • 2014-02-06
  • 2021-04-12
  • 2021-12-24
  • 1970-01-01
  • 2019-08-22
相关资源
最近更新 更多