Get-EntraServicePrincipal

Hiermee haalt u een service-principal op.

Syntax

GetQuery (Standaard)

Get-EntraServicePrincipal

    [-Top <Int32>]
    [-All]
    [-Filter <String>]
    [-Property <String[]>]
    [-AssignmentRequired <Boolean>]
    [-ApplicationType <String>]
    [<CommonParameters>]

GetVague

Get-EntraServicePrincipal

    [-SearchString <String>]
    [-All]
    [-Property <String[]>]
    [-AssignmentRequired <Boolean>]
    [-ApplicationType <String>]
    [<CommonParameters>]

GetById

Get-EntraServicePrincipal

    -ServicePrincipalId <String>
    [-All]
    [-Property <String[]>]
    [<CommonParameters>]

Description

De Get-EntraServicePrincipal cmdlet haalt een service-principal op in Microsoft Entra ID.

Voorbeelden

Voorbeeld 1: alle service-principals ophalen uit de map

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal
ObjectId                             AppId                                DisplayName
--------                             -----                                -----------
bbbbbbbb-1111-2222-3333-cccccccccccc 00001111-aaaa-2222-bbbb-3333cccc4444 Demo App
aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 22223333-cccc-4444-dddd-5555eeee6666 Demo Two App
dddddddd-3333-4444-5555-eeeeeeeeeeee 33334444-dddd-5555-eeee-6666ffff7777 ProjectWorkManagement

In dit voorbeeld worden alle service-principals opgehaald uit de map.

Voorbeeld 2: Een service-principal ophalen door ServicePrincipalId

Connect-Entra -Scopes 'Application.Read.All'
$servicePrincipal = Get-EntraServicePrincipal -Filter "displayName eq 'Helpdesk Application'"
Get-EntraServicePrincipal -ServicePrincipalId $servicePrincipal.Id
DisplayName                         Id                                   AppId                                SignInAudience      ServicePrincipalType
-----------                         --                                   -----                                --------------      --------------------
Helpdesk Application                aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 00001111-aaaa-2222-bbbb-3333cccc4444 AzureADMultipleOrgs Application

Met deze opdracht wordt een specifieke service-principal opgehaald.

  • -ServicePrincipalId Parameter geeft de id van een service-principal op.

Voorbeeld 3: alle service-principals ophalen uit de map

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal -All
DisplayName                         Id                                   AppId                                SignInAudience      ServicePrincipalType
-----------                         --                                   -----                                --------------      --------------------
Helpdesk Application                aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 00001111-aaaa-2222-bbbb-3333cccc4444 AzureADMultipleOrgs Application
Microsoft Device Management Checkin bbbbbbbb-1111-2222-3333-cccccccccccc 11112222-bbbb-3333-cccc-4444dddd5555 AzureADMultipleOrgs Application
ProvisioningPowerBi                 cccccccc-2222-3333-4444-dddddddddddd 22223333-cccc-4444-dddd-5555eeee6666                     Application

In dit voorbeeld worden alle service-principals opgehaald uit de map.

Voorbeeld 4: de twee belangrijkste service-principals ophalen uit de map

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal -Top 2
DisplayName                         Id                                   AppId                                SignInAudience      ServicePrincipalType
-----------                         --                                   -----                                --------------      --------------------
Helpdesk Application                aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 00001111-aaaa-2222-bbbb-3333cccc4444 AzureADMultipleOrgs Application
Microsoft Device Management Checkin bbbbbbbb-1111-2222-3333-cccccccccccc 11112222-bbbb-3333-cccc-4444dddd5555 AzureADMultipleOrgs Application

Met deze opdracht worden de twee belangrijkste service-principals opgehaald uit de map. U kunt -Limit gebruiken als alias voor -Top.

Voorbeeld 5: Een service-principal ophalen op weergavenaam

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal -Filter "displayName eq 'Helpdesk Application'"
DisplayName                         Id                                   AppId                                SignInAudience      ServicePrincipalType
-----------                         --                                   -----                                --------------      --------------------
Helpdesk Application                aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 00001111-aaaa-2222-bbbb-3333cccc4444 AzureADMultipleOrgs Application

In dit voorbeeld krijgt u een service-principal op basis van de weergavenaam.

Voorbeeld 6: Een lijst met alle service-principals ophalen, met een weergavenaam die 'Helpdesktoepassing' bevat

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal -SearchString 'Helpdesk Application'
DisplayName                         Id                                   AppId                                SignInAudience      ServicePrincipalType
-----------                         --                                   -----                                --------------      --------------------
Helpdesk Application                aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 00001111-aaaa-2222-bbbb-3333cccc4444 AzureADMultipleOrgs Application

In dit voorbeeld wordt een lijst met service-principals weergegeven met de opgegeven weergavenaam.

Voorbeeld 7: Alle Enterprise-apps ophalen

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal -Filter "tags/Any(x: x eq 'WindowsAzureActiveDirectoryIntegratedApp')"
DisplayName         Id                                   AppId                                SignInAudience         ServicePrincipalType
-----------         --                                   -----                                --------------         --------------------
Enterprise App1     00001111-aaaa-2222-bbbb-3333cccc4444 33334444-dddd-5555-eeee-6666ffff7777                         Application
Enterprise App2     11112222-bbbb-3333-cccc-4444dddd5555 22223333-cccc-4444-dddd-5555eeee6666 AzureADMultipleOrgs    Application

In dit voorbeeld ziet u hoe u alle bedrijfsapps ophaalt.

Voorbeeld 8: Alle app-proxy-apps ophalen

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal -Filter "tags/Any(x: x eq 'WindowsAzureActiveDirectoryOnPremApp')"
DisplayName         Id                                   AppId                                SignInAudience         ServicePrincipalType
-----------         --                                   -----                                --------------         --------------------
App proxy 1     00001111-aaaa-2222-bbbb-3333cccc4444 33334444-dddd-5555-eeee-6666ffff7777                         Application
App proxy 2     11112222-bbbb-3333-cccc-4444dddd5555 22223333-cccc-4444-dddd-5555eeee6666 AzureADMultipleOrgs    Application

In dit voorbeeld ziet u hoe u alle app-proxy-apps ophaalt.

Voorbeeld 9: Alle uitgeschakelde apps ophalen

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal -Filter "accountEnabled eq false"
DisplayName         Id                                   AppId                                SignInAudience         ServicePrincipalType
-----------         --                                   -----                                --------------         --------------------
Disabled App1     00001111-aaaa-2222-bbbb-3333cccc4444 33334444-dddd-5555-eeee-6666ffff7777                         Application

In dit voorbeeld ziet u hoe u alle uitgeschakelde apps ophaalt.

Voorbeeld 10: alle global Secure Access-apps ophalen

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal -Filter "tags/Any(x: x eq 'PrivateAccessNonWebApplication') or tags/Any(x: x eq 'NetworkAccessManagedApplication')"
DisplayName         Id                                   AppId                                SignInAudience         ServicePrincipalType
-----------         --                                   -----                                --------------         --------------------
Global secure access app     00001111-aaaa-2222-bbbb-3333cccc4444 33334444-dddd-5555-eeee-6666ffff7777                         Application

In dit voorbeeld ziet u hoe u alle globale beveiligde toegangsapps ophaalt.

Voorbeeld 11: Alle toepassingen zonder gebruikerstoewijzing weergeven

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal -All | Where-Object {$_.appRoleAssignmentRequired -ne 'true'}
DisplayName                     Id                                   AppId                                SignInAudience         ServicePrincipalType
-----------                     --                                   -----                                --------------         --------------------
App without user assignment     00001111-aaaa-2222-bbbb-3333cccc4444 33334444-dddd-5555-eeee-6666ffff7777                         Application

In dit voorbeeld ziet u hoe u alle toepassingen zonder gebruikerstoewijzing ophaalt.

Voorbeeld 12: alle SAML-toepassingsgegevens weergeven

Connect-Entra -Scopes 'Application.Read.All'
$servicePrincipal = Get-EntraServicePrincipal -Filter "PreferredSingleSignOnMode eq 'saml'"
$servicePrincipal | Select-Object Id, DisplayName, AccountEnabled, AppId, PreferredSingleSignOnMode, AppRoleAssignmentRequired, SignInAudience, NotificationEmailAddresses, PreferredTokenSigningKeyEndDateTime, PreferredTokenSigningKeyValid, ReplyUrls,LoginUrl, LogoutUrl | Format-Table -AutoSize
Id                                   DisplayName                           AccountEnabled AppId                                PreferredSingleSignOnMode AppRoleAssignmentRequired SignInAudience NotificationEmailAddresses
--                                   -----------                           -------------- -----                                ------------------------- ------------------------- -------------- --------------
00001111-aaaa-2222-bbbb-3333cccc4444 SAML App                             True            33334444-dddd-5555-eeee-6666ffff7777 saml                              True                    AzureADMyOrg   {admin@Contoso}

In dit voorbeeld ziet u hoe u alle DETAILS van de SAML-toepassing ophaalt.

Voorbeeld 13: service-principal-app-rollen vermelden

Connect-Entra -Scopes 'Application.Read.All'
$servicePrincipal = Get-EntraServicePrincipal -SearchString 'Contoso Helpdesk Application'
$servicePrincipal.AppRoles | Format-Table -AutoSize
AllowedMemberTypes    Description        DisplayName       Id                                   IsEnabled  Origin       Value
------------------    -----------        -----------       --                                   ---------  ------       -----
{User, Application}   General All        General All       gggggggg-6666-7777-8888-hhhhhhhhhhhh  True       Application  Survey.Read
{Application}         General App Only   General Apponly   hhhhhhhh-7777-8888-9999-iiiiiiiiiiii  True       Application  Task.Write
{User}                General role       General           bbbbbbbb-1111-2222-3333-cccccccccccc  True       Application  General

In dit voorbeeld ziet u hoe u app-rollen voor een service-principal kunt ophalen.

Voorbeeld 14: Toepassingen (service-principals) buiten mijn tenant vermelden

Connect-Entra -Scopes 'Application.Read.All'
$tenantId = Get-EntraContext | Select-Object -ExpandProperty TenantId
$servicePrincipals = Get-EntraServicePrincipal -All -Property AppOwnerOrganizationId, Id, DisplayName, AppId
$externalServicePrincipals = $servicePrincipals | Where-Object { $_.AppOwnerOrganizationId -ne $tenantId }
$externalServicePrincipals | Select-Object DisplayName, Id, AppId, AppOwnerOrganizationId | Format-Table -AutoSize
DisplayName                                             Id                                   AppId                                AppOwnerOrganizationId
-----------                                             --                                   -----                                ----------------------
Azure MFA StrongAuthenticationService                   aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 00001111-aaaa-2222-bbbb-3333cccc4444 f8cdef31-a31e-4b4a-93e4-5f571e91255a
M365 Label Analytics                                    bbbbbbbb-1111-2222-3333-cccccccccccc 11112222-bbbb-3333-cccc-4444dddd5555 f8cdef31-a31e-4b4a-93e4-5f571e91255a
PowerApps-Advisor                                       cccccccc-2222-3333-4444-dddddddddddd 22223333-cccc-4444-dddd-5555eeee6666 f8cdef31-a31e-4b4a-93e4-5f571e91255a

In dit voorbeeld ziet u hoe u toepassingen (service-principals) buiten mijn tenant kunt ophalen.

Voorbeeld 15: Service-principals ophalen met gebruikerstoewijzing vereist

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal -AssignmentRequired $true
DisplayName                Id                                   AppId                                SignInAudience      ServicePrincipalType
-----------                --                                   -----                                --------------      --------------------
Restricted App             aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 00001111-aaaa-2222-bbbb-3333cccc4444 AzureADMyOrg        Application

In dit voorbeeld worden alle service-principals opgehaald waarvoor gebruikerstoewijzing is vereist voor toegang tot de toepassing.

Voorbeeld 16: Enterprise-apps ophalen met de parameter ApplicationType

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal -ApplicationType EnterpriseApps
DisplayName         Id                                   AppId                                SignInAudience         ServicePrincipalType
-----------         --                                   -----                                --------------         --------------------
Enterprise App1     00001111-aaaa-2222-bbbb-3333cccc4444 33334444-dddd-5555-eeee-6666ffff7777                         Application
Enterprise App2     11112222-bbbb-3333-cccc-4444dddd5555 22223333-cccc-4444-dddd-5555eeee6666 AzureADMultipleOrgs    Application

In dit voorbeeld ziet u hoe u alle bedrijfs-apps ophaalt met behulp van de parameter ApplicationType. Geldige waarden zijn: AppProxyApps, EnterpriseApps, ManagedIdentity, MicrosoftApps.

Voorbeeld 17: Beheerde identiteiten ophalen

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal -ApplicationType ManagedIdentity
DisplayName         Id                                   AppId                                SignInAudience         ServicePrincipalType
-----------         --                                   -----                                --------------         --------------------
MyVM-Identity       00001111-aaaa-2222-bbbb-3333cccc4444 33334444-dddd-5555-eeee-6666ffff7777                         ManagedIdentity

In dit voorbeeld worden alle beheerde identiteiten opgehaald.

Voorbeeld 18: Filters voor AssignmentRequired en ApplicationType combineren

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraServicePrincipal -AssignmentRequired $true -ApplicationType EnterpriseApps
DisplayName                Id                                   AppId                                SignInAudience      ServicePrincipalType
-----------                --                                   -----                                --------------      --------------------
Secured Enterprise App     aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb 00001111-aaaa-2222-bbbb-3333cccc4444 AzureADMyOrg        Application

In dit voorbeeld ziet u hoe u de parameters AssignmentRequired en ApplicationType combineert om bedrijfsapps te filteren waarvoor gebruikerstoewijzing is vereist.

Parameters

-All

Alle pagina's weergeven.

Parametereigenschappen

Type:System.Management.Automation.SwitchParameter
Default value:False
Ondersteunt jokertekens:False
DontShow:False

Parametersets

(All)
Position:Named
Verplicht:False
Waarde uit pijplijn:False
Waarde uit pijplijn op eigenschapsnaam:False
Waarde van resterende argumenten:False

-ApplicationType

Filteren op toepassingstype. Geldige waarden zijn:

  • AppProxyApps: Toepassingsproxytoepassingen
  • EnterpriseApps: Bedrijfstoepassingen
  • ManagedIdentity: Service-principals voor beheerde identiteit
  • MicrosoftApps: Microsoft toepassingen van derden

Parametereigenschappen

Type:System.String
Default value:None
Ondersteunt jokertekens:False
DontShow:False

Parametersets

GetQuery
Position:Named
Verplicht:False
Waarde uit pijplijn:True
Waarde uit pijplijn op eigenschapsnaam:True
Waarde van resterende argumenten:False
GetVague
Position:Named
Verplicht:False
Waarde uit pijplijn:True
Waarde uit pijplijn op eigenschapsnaam:True
Waarde van resterende argumenten:False

-AssignmentRequired

Filter op of gebruikerstoewijzing is vereist voor toegang tot de toepassing. Wanneer ingesteld op $true, worden alleen service-principals geretourneerd waarvoor gebruikerstoewijzing vereist is. Wanneer deze waarde is ingesteld op $false, worden alleen service-principals geretourneerd waarvoor gebruikerstoewijzing niet is vereist.

Parametereigenschappen

Type:System.Boolean
Default value:None
Ondersteunt jokertekens:False
DontShow:False

Parametersets

GetQuery
Position:Named
Verplicht:False
Waarde uit pijplijn:True
Waarde uit pijplijn op eigenschapsnaam:True
Waarde van resterende argumenten:False
GetVague
Position:Named
Verplicht:False
Waarde uit pijplijn:True
Waarde uit pijplijn op eigenschapsnaam:True
Waarde van resterende argumenten:False

-Filter

Hiermee geeft u een OData v4.0-filterinstructie op. Met deze parameter bepaalt u welke objecten worden geretourneerd.

Parametereigenschappen

Type:System.String
Default value:None
Ondersteunt jokertekens:False
DontShow:False

Parametersets

GetQuery
Position:Named
Verplicht:False
Waarde uit pijplijn:True
Waarde uit pijplijn op eigenschapsnaam:True
Waarde van resterende argumenten:False

-Property

Hiermee geeft u eigenschappen die moeten worden geretourneerd.

Parametereigenschappen

Type:

System.String[]

Default value:None
Ondersteunt jokertekens:False
DontShow:False
Aliassen:Selecteren

Parametersets

(All)
Position:Named
Verplicht:False
Waarde uit pijplijn:False
Waarde uit pijplijn op eigenschapsnaam:False
Waarde van resterende argumenten:False

-SearchString

Hiermee geeft u een zoekreeks op.

Parametereigenschappen

Type:System.String
Default value:None
Ondersteunt jokertekens:False
DontShow:False

Parametersets

GetVague
Position:Named
Verplicht:False
Waarde uit pijplijn:True
Waarde uit pijplijn op eigenschapsnaam:True
Waarde van resterende argumenten:False

-ServicePrincipalId

Hiermee geeft u de id van een service-principal in Microsoft Entra ID.

Parametereigenschappen

Type:System.String
Default value:None
Ondersteunt jokertekens:False
DontShow:False
Aliassen:ObjectId

Parametersets

GetById
Position:Named
Verplicht:True
Waarde uit pijplijn:True
Waarde uit pijplijn op eigenschapsnaam:True
Waarde van resterende argumenten:False

-Top

Hiermee geeft u het maximum aantal records dat moet worden geretourneerd.

Parametereigenschappen

Type:System.Int32
Default value:None
Ondersteunt jokertekens:False
DontShow:False
Aliassen:Limit

Parametersets

GetQuery
Position:Named
Verplicht:False
Waarde uit pijplijn:True
Waarde uit pijplijn op eigenschapsnaam:True
Waarde van resterende argumenten:False

CommonParameters

Deze cmdlet ondersteunt de algemene parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction en -WarningVariable. Zie about_CommonParametersvoor meer informatie.