当前位置:网站首页 > 更多 > 玩电脑 > 正文

[玩转系统] Get-MsolServicePrincipal - 获取服务主体

作者:精品下载站 日期:2024-12-14 06:26:58 浏览:14 分类:玩电脑

Get-MsolServicePrincipal - 获取服务主体


PowerShell 中的 Get-MsolServicePrincipal cmdlet 从 Microsoft Office 365 获取服务主体。

下面给出了从 Azure Active Directory 检索服务主体的语法。

Get-MsolServicePrincipal
   [-SearchString <String>]
   -ObjectId <Guid>
   -ServicePrincipalName <String>
   -AppPrincipalId <Guid>
   [-All]
   [-MaxResults <Int32>]
   [-TenantId <Guid>]
   [<CommonParameters>]

在本文中,我们将讨论如何使用 PowerShell 中的 Get-MsolServicePrincipal cmdlet 从 Azure Active Directory 获取服务主体或服务主体列表。

如何获取 Azure Active Directory 中的所有服务主体

要获取 Azure Active Directory 中的所有服务主体,请在 PowerShell 中使用 Get-MsolServicePrincipal cmdlet。

Get-MsolServicePrincipal

此命令显示 Office 365 租户中的所有现有服务主体。

[玩转系统] Get-MsolServicePrincipal - 获取服务主体

如何通过名称获取服务主体

要使用名称获取服务主体,请使用带有 -ServicePrincipalName 参数的 Get-MsolServicePricipal cmdlet。

-ServicePrincipalName 参数指定要获取的一个或多个服务主体的名称。

Get-MsolServicePrincipal -ServicePrincipalName "ShellGeekApp/ShellApp.com"

此命令获取一个服务主体,其服务主体名称以“ShellGeekApp/ShellApp.com”开头。

PS C:\> Get-MsolServicePrincipal -ServicePrincipalName "ShellGeekApp/ShellApp.com"                                           

ExtensionData         : System.Runtime.Serialization.ExtensionDataObject
AccountEnabled        : True
Addresses             : {}
AppPrincipalId        : b11edafd-3e79-4695-9d2a-c59e78966d35
DisplayName           : ShellGeek App
ObjectId              : ed85a14d-780e-4bed-aaf0-96c720085082
ServicePrincipalNames : {b11edafd-3e79-4695-9d2a-c59e78966d35, ShellGeekApp/ShellApp.com}
TrustedForDelegation  : False

如何使用应用程序主体 ID 获取服务主体名称

要获取具有特定应用程序主体 ID 的服务主体,请使用带有 -AppPrincipalId 参数的 Get-MsolServicePrincipal cmdlet。

-AppPrincipalId 参数指定要获取的服务主体的唯一应用程序 ID。

Get-MsolServicePrincipal -AppPrincipalId b11edafd-3e79-4695-9d2a-c59e78966d35

此命令返回具有特定应用程序主体 ID 的服务主体名称。

PS C:\> Get-MsolServicePrincipal -AppPrincipalId b11edafd-3e79-4695-9d2a-c59e78966d35                                        

ExtensionData         : System.Runtime.Serialization.ExtensionDataObject
AccountEnabled        : True
Addresses             : {}
AppPrincipalId        : b11edafd-3e79-4695-9d2a-c59e78966d35
DisplayName           : ShellGeek App
ObjectId              : ed85a14d-780e-4bed-aaf0-96c720085082
ServicePrincipalNames : {b11edafd-3e79-4695-9d2a-c59e78966d35, ShellGeekApp/ShellApp.com}
TrustedForDelegation  : False

结论

我希望上述有关如何在 PowerShell 中使用 Get-MsolServicePrincipal cmdlet 获取 Azure Active Directory 中的服务主体名称的文章对您有所帮助。

您可以在 ShellGeek 主页上找到有关 PowerShell Active Directory 命令和 PowerShell 基础知识的更多主题。

相关链接

新-MsolServicePrincipal

删除-MsolServicePrincipal

设置 MsolServicePrincipal

您需要 登录账户 后才能发表评论

取消回复欢迎 发表评论:

关灯