[英]How to access the newly created application's ObjectId from AzureAD v2 cmdlet for PowerShell?
有没有办法在AzureAD v2 cmdlet for PowerShell
中AzureAD v2 cmdlet for PowerShell
新创建的应用程序的最新ObjectId
?
The result of the PowerShell cmdlet New-AzureADApplication
will be the Application object, including the ObjectId
attribute: PowerShell cmdlet New-AzureADApplication
将是Application对象,包括ObjectId
属性:
PS C:\> New-AzureADApplication -DisplayName "My Special App" -IdentifierUris @("https://localhost/my-special-app")
ObjectId AppId DisplayName
-------- ----- ----------
4a9c0714-adf9-42f4-9189-a69fa2c33861 0f6b4c20-957a-4c96-b477-5562995fd920 My Special App
The best way to use do this in your script is to place the result in a variable: 在脚本中执行此操作的最佳方法是将结果放入变量中:
PS C:\> $app = New-AzureADApplication -DisplayName "My Special App" -IdentifierUris @("https://localhost/my-special-app")
PS C:\> $app.ObjectId
4a9c0714-adf9-42f4-9189-a69fa2c33861
If you're looking for the ObjectId
of an Application object which already exists, you would search for it by name: 如果要查找已经存在的Application对象的ObjectId
,则可以按名称搜索它:
PS C:\> Get-AzureADApplication -SearchString "My"
ObjectId AppId DisplayName
-------- ----- -----------
4a9c0714-adf9-42f4-9189-a69fa2c33861 0f6b4c20-957a-4c96-b477-5562995fd920 My Special App
4254aa16-b04d-4ce8-9d0b-9b439984499a a4dfe0f4-4406-4906-af67-7201aef85db7 My Other Special App
(Note: The -SearchString
parameter does "startswith" searches, not "contains".) (注意: -SearchString
参数执行“ startswith”搜索,而不是“ contains”。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.