使用 AZ Powershell 模块注册本机应用程序
Native App Registration with AZ Powershell Module
我需要使用 AZ Powershell 6 模块在 Azure Active Directory 上注册本机应用程序。
可以在 AzureAD 模块中使用命令 New-AzureADApplication 注册本机应用程序,将字段 "PublicClient" 的值设置为 true,但 Powershell 6 不支持模块 AzureAD。
在 powershell 6 中,相应的命令似乎是 New-AzADApplication,它允许注册 Web 应用程序/API但不能注册本机应用程序。
那么如何在 powershell 6 中使用模块 AZ 注册本机应用程序?
谢谢。
好像不支持直接使用Az
创建原生应用。 Azure 发布了名为 AzureAD.Standard.Preview
的 AzureAD 模块预览版,支持 Powershell Core 6
,该模块提供与 AzureAD
相同的功能。您可以像 AzureAD
一样使用它来创建本机应用程序。
PowerShell 库:https://www.poshtestgallery.com/packages/AzureAD.Standard.Preview/0.1.599.7
Install-Module -Name AzureAD.Standard.Preview
有关详细信息,请参阅:Azure AD PowerShell module with support for PowerShell Core。
如果您尝试 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\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
记得总是在 Login-AzAccount
之前调用 Connect-AzureAD
否则你会收到一个错误。
感谢 Joy Wang 和最诚挚的问候。
我需要使用 AZ Powershell 6 模块在 Azure Active Directory 上注册本机应用程序。 可以在 AzureAD 模块中使用命令 New-AzureADApplication 注册本机应用程序,将字段 "PublicClient" 的值设置为 true,但 Powershell 6 不支持模块 AzureAD。
在 powershell 6 中,相应的命令似乎是 New-AzADApplication,它允许注册 Web 应用程序/API但不能注册本机应用程序。
那么如何在 powershell 6 中使用模块 AZ 注册本机应用程序?
谢谢。
好像不支持直接使用Az
创建原生应用。 Azure 发布了名为 AzureAD.Standard.Preview
的 AzureAD 模块预览版,支持 Powershell Core 6
,该模块提供与 AzureAD
相同的功能。您可以像 AzureAD
一样使用它来创建本机应用程序。
PowerShell 库:https://www.poshtestgallery.com/packages/AzureAD.Standard.Preview/0.1.599.7
Install-Module -Name AzureAD.Standard.Preview
有关详细信息,请参阅:Azure AD PowerShell module with support for PowerShell Core。
如果您尝试 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\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
记得总是在 Login-AzAccount
之前调用 Connect-AzureAD
否则你会收到一个错误。
感谢 Joy Wang 和最诚挚的问候。