powershell - 使用 AZ Powershell 模块注册 native 应用程序

标签 powershell azure-active-directory registration nativeapplication

我需要使用 AZ Powershell 6 模块在 Azure Active Directory 上注册 native 应用程序。
可以使用 AzureAD 模块中的命令 New-AzureADApplication 将“PublicClient”字段的值设置为 true 来注册 native 应用程序,但 powershell 6 不支持模块 AzureAD。

在 powershell 6 中,对应的命令似乎是 New-AzADApplication,它允许注册 Web 应用程序/API,但不能注册 native 应用程序。

那么如何在 powershell 6 中使用模块 AZ 注册 native 应用程序呢?

谢谢。

最佳答案

如果你尝试 Install-Module -Name AzureAD.Standard.Preview您将收到以下错误:

"PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'AzureAD.Standard.Preview'. Try Get-PSRepository to see all available registered module repositories.
At C:\program files\powershell\6\Modules\PowerShellGet\PSModule.psm1:9491 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage"

因此,您必须使用以下命令添加存储库:
PS> Register-PSRepository -Name PreviewRepository -SourceLocation 'https://www.poshtestgallery.com/api/v1'

然后安装并导入模块
PS> Install-Module -Name AzureAD.Standard.Preview
PS> Import-Module AzureAD.Standard.Preview

检查模块是否正确安装并导入所有命令。
PS> Get-Module -ListAvailable

记得调用Connect-AzureAD总是在 Login-AzAccount 之前否则您将收到错误消息。

感谢 Joy Wang 和最诚挚的问候。

关于powershell - 使用 AZ Powershell 模块注册 native 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55116923/

相关文章:

azure - 弃用 login.microsoftonline.com 对 B2C 租户的实际影响

visual-studio - 添加 Windows 通用控件 6.0 时未注册对象库

docker - 如何在 consul 容器中为同一主机上的服务定义 HTTP 健康检查?

powershell - 注册表 `registry::` 的 PSPath - 为什么是双冒号?

PowerShell脚本错误: the string is missing the terminator:

azure - 如何在没有 Azure stack 的情况下通过 API/CLI 创建新的目录租户?

php - 阻止一个人创建多个帐户的最佳方法

powershell - 如何使用 user_data(AWS 和 Terraform)传递 PowerShell 脚本?

powershell - 从 PowerShell 函数调用回调

c# - 注销后重定向在 Asp.net Core 2 中不起作用