Native App Registration with AZ Powershell Module

為{幸葍}努か 提交于 2021-02-08 08:24:40

问题


I need to register a native app on Azure Active Directory using the AZ Powershell 6 Module. A native app can be registered with the command New-AzureADApplication in the AzureAD module setting the value of the field "PublicClient" to true, but the module AzureAD is not supported for powershell 6.

In powershell 6 it seems that the corresponding command is New-AzADApplication, which allows to register a Web app / API but not a native app.

So how is it possible to register a native app with the module AZ in powershell 6?

Thanks.


回答1:


It seems not to support to use Az to create a native app directly. Azure has released a preview version of AzureAD module named AzureAD.Standard.Preview which supports Powershell Core 6, this module provides the same functionality as AzureAD. You could use it like the AzureAD to create the native app.

PowerShell Gallery: https://www.poshtestgallery.com/packages/AzureAD.Standard.Preview/0.1.599.7

Install-Module -Name AzureAD.Standard.Preview

For more details, see : Azure AD PowerShell module with support for PowerShell Core.




回答2:


If you try Install-Module -Name AzureAD.Standard.Preview you will receive the following error:

"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"

So you have to add the repository with the following command:

PS> Register-PSRepository -Name PreviewRepository -SourceLocation 'https://www.poshtestgallery.com/api/v1'

Then install and import the module

PS> Install-Module -Name AzureAD.Standard.Preview
PS> Import-Module AzureAD.Standard.Preview

Check the module is correctly installed and all the commands are imported.

PS> Get-Module -ListAvailable

Remember to call Connect-AzureAD always before Login-AzAccount or you will receive an error.

Thanks to Joy Wang and best regards.



来源:https://stackoverflow.com/questions/55116923/native-app-registration-with-az-powershell-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!