Get-EntraApplication

Ottiene un'applicazione.

Sintassi

GetQuery (Impostazione predefinita)

Get-EntraApplication

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

GetByValue

Get-EntraApplication

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

GetById

Get-EntraApplication

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

Descrizione

Il Get-EntraApplication cmdlet ottiene un'applicazione Microsoft Entra ID.

Esempio

Esempio 1: Ottenere un'applicazione da ApplicationId

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraApplication -ApplicationId 'aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb'
DisplayName         Id                                   AppId                                SignInAudience PublisherDomain
-----------         --                                   -----                                -------------- ---------------
ToGraph_443democc3c aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb bbbbbbbb-1111-2222-3333-cccccccccccc AzureADMyOrg   contoso.com

In questo esempio viene illustrato come recuperare un'applicazione specifica specificando l'ID.

Esempio 2: Ottenere tutte le applicazioni

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraApplication -All
DisplayName         Id                                   AppId                                SignInAudience                     PublisherDomain
-----------         --                                   -----                                --------------                     ---------------
test app            aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb bbbbbbbb-1111-2222-3333-cccccccccccc AzureADandPersonalMicrosoftAccount contoso.com
ToGraph_443DEM      cccccccc-4444-5555-6666-dddddddddddd dddddddd-5555-6666-7777-eeeeeeeeeeee AzureADMyOrg                       contoso.com
test adms           eeeeeeee-6666-7777-8888-ffffffffffff ffffffff-7777-8888-9999-gggggggggggg AzureADandPersonalMicrosoftAccount contoso.com
test adms app azure gggggggg-8888-9999-aaaa-hhhhhhhhhhhh hhhhhhhh-9999-aaaa-bbbb-iiiiiiiiiiii AzureADandPersonalMicrosoftAccount contoso.com
test adms2          iiiiiiii-aaaa-bbbb-cccc-jjjjjjjjjjjj jjjjjjjj-bbbb-cccc-dddd-kkkkkkkkkkkk AzureADandPersonalMicrosoftAccount contoso.com

Questo esempio illustra come ottenere tutte le applicazioni da Microsoft Entra ID.

Esempio 3: Ottenere tutte le applicazioni senza proprietari (applicazioni senza proprietario)

Connect-Entra -Scopes 'Application.Read.All'
$apps = Get-EntraApplication -All
$appsWithoutOwners = @()
foreach ($app in $apps) {
    try {
        $owners = Get-EntraApplicationOwner -ApplicationId $app.Id
        if (-not $owners) {
            $appsWithoutOwners += $app
        }
    }
    catch {
        Write-Warning "Failed to check owners for app: $($app.DisplayName)"
    }

    # Optional: throttle to avoid rate limits (especially in large tenants)
    #Start-Sleep -Milliseconds 100
}
$appsWithoutOwners | Select-Object DisplayName, Id, AppId
DisplayName          Id                                   AppId
-----------          --                                   -----
Contoso HR App       aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb bbbbbbbb-1111-2222-3333-cccccccccccc
Contoso Helpdesk App cccccccc-4444-5555-6666-dddddddddddd dddddddd-5555-6666-7777-eeeeeeeeeeee
Contoso Helpdesk App eeeeeeee-6666-7777-8888-ffffffffffff hhhhhhhh-9999-aaaa-bbbb-iiiiiiiiiiii

Questo esempio illustra come ottenere tutte le applicazioni senza proprietari da Microsoft Entra ID.

Esempio 4: Ottenere applicazioni con segreti in scadenza in 30 giorni

$expirationThreshold = (Get-Date).AddDays(30)
$appsWithExpiringPasswords = Get-EntraApplication -All | Where-Object { $_.PasswordCredentials } |
ForEach-Object {
    $app = $_
    $app.PasswordCredentials | Where-Object { $_.EndDate -le $expirationThreshold } |
    ForEach-Object {
        [PSCustomObject]@{
            DisplayName       = $app.DisplayName
            AppId             = $app.AppId
            SecretDisplayName = $_.DisplayName
            KeyId             = $_.KeyId
            ExpiringSecret    = $_.EndDate
        }
    }
}
$appsWithExpiringPasswords | Format-Table DisplayName, AppId, SecretDisplayName, KeyId, ExpiringSecret -AutoSize
DisplayName             AppId                                SecretDisplayName    KeyId                                ExpiringSecret
-----------             -----                                -----------------    -----                                --------------
Helpdesk Application    dddddddd-5555-6666-7777-eeeeeeeeeeee Helpdesk Password    aaaaaaaa-0b0b-1c1c-2d2d-333333333333 11/18/2024

Questo esempio recupera le applicazioni con segreti in scadenza entro 30 giorni.

Esempio 5: Ottenere applicazioni con certificati in scadenza in 30 giorni

$expirationThreshold = (Get-Date).AddDays(30)
$appsWithExpiringKeys = Get-EntraApplication -All | Where-Object { $_.KeyCredentials } |
ForEach-Object {
    $app = $_
    $app.KeyCredentials | Where-Object { $_.EndDate -le $expirationThreshold } |
    ForEach-Object {
        [PSCustomObject]@{
            DisplayName            = $app.DisplayName
            AppId                  = $app.AppId
            CertificateDisplayName = $_.DisplayName
            KeyId                  = $_.KeyId
            ExpiringKeys           = $_.EndDate
        }
    }
}
$appsWithExpiringKeys | Format-Table DisplayName, AppId, CertificateDisplayName, KeyId, ExpiringKeys -AutoSize
DisplayName             AppId                                CertificateDisplayName KeyId                                ExpiringKeys
-----------             -----                                ---------------------- -----                                ------------
Helpdesk Application dddddddd-5555-6666-7777-eeeeeeeeeeee My cert                aaaaaaaa-0b0b-1c1c-2d2d-333333333333 6/27/2024 11:49:17 AM

Questo esempio recupera le applicazioni con certificati in scadenza entro 30 giorni.

Esempio 6: Ottenere un'applicazione in base al nome visualizzato

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraApplication -Filter "DisplayName eq 'ToGraph_443DEMO'"
DisplayName     Id                                   AppId                                SignInAudience PublisherDomain
-----------     --                                   -----                                -------------- ---------------
ToGraph_443DEMO cccccccc-4444-5555-6666-dddddddddddd dddddddd-5555-6666-7777-eeeeeeeeeeee AzureADMyOrg   contoso.com

In questo esempio viene recuperata l'applicazione in base al nome visualizzato da Microsoft Entra ID.

Esempio 7: Cercare tra le applicazioni recuperate

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraApplication -SearchString 'My new application 2'
DisplayName          Id                                   AppId                                SignInAudience                     PublisherDomain
-----------          --                                   -----                                --------------                     ---------------
My new application 2 kkkkkkkk-cccc-dddd-eeee-llllllllllll llllllll-dddd-eeee-ffff-mmmmmmmmmmmm AzureADandPersonalMicrosoftAccount contoso.com

In questo esempio viene illustrato come recuperare applicazioni per una stringa specifica da Microsoft Entra ID.

Esempio 8: Recuperare un'applicazione in base a identifierUris

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraApplication -Filter "identifierUris/any(uri:uri eq 'https://wingtips.wingtiptoysonline.com')"

In questo esempio viene illustrato come recuperare le applicazioni in base agli identificatoriUri da Microsoft Entra ID.

Esempio 9: Elencare le prime 2 applicazioni

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraApplication -Top 2
DisplayName         Id                                   AppId                                SignInAudience                     PublisherDomain
-----------         --                                   -----                                --------------                     ---------------
test app            aaaaaaaa-0000-1111-2222-bbbbbbbbbbbb bbbbbbbb-1111-2222-3333-cccccccccccc AzureADandPersonalMicrosoftAccount contoso.com
ToGraph_443DEM      cccccccc-4444-5555-6666-dddddddddddd dddddddd-5555-6666-7777-eeeeeeeeeeee AzureADMyOrg                       contoso.com

In questo esempio viene illustrato come recuperare due applicazioni. È possibile usare -Limit come alias per -Top.

Esempio 10: Elencare i ruoli dell'app dell'applicazione

Connect-Entra -Scopes 'Application.Read.All'
$application = Get-EntraApplication -SearchString 'Contoso Helpdesk Application'
$application.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

Questo esempio illustra come recuperare i ruoli dell'app per un'applicazione.

Esempio 11: Elencare l'applicazione oauth2PermissionScopes (autorizzazioni delegate esposte dall'app)

Connect-Entra -Scopes 'Application.Read.All'
(Get-EntraApplication -Filter "displayName eq 'Contoso Helpdesk Application'").Api.Oauth2PermissionScopes
AdminConsentDescription : Allows the app to read HR data on behalf of users.
AdminConsentDisplayName : Read HR Data
Id                      : bbbbbbbb-1111-2222-3333-cccccccccccc
IsEnabled               : True
Origin                  :
Type                    : User
UserConsentDescription  : Allows the app to read your HR data.
UserConsentDisplayName  : Read your HR data
Value                   : HR.Read.All

Questo esempio mostra come recuperare oauth2PermissionScopes (ad esempio, le autorizzazioni delegate esposte dall'app) a un'entità servizio. Questi ambiti fanno parte dell'oggetto applicazione.

Esempio 12: Elencare le applicazioni e i relativi dettagli segreti

Connect-Entra -Scopes 'Application.Read.All'
Get-EntraApplication -All -Property displayName, appId, passwordCredentials |
    Where-Object { $_.PasswordCredentials } |
    ForEach-Object {
        $app = $_
        foreach ($cred in $app.PasswordCredentials) {
            [PSCustomObject]@{
                DisplayName                    = $app.DisplayName
                AppId                          = $app.AppId
                PasswordCredentialsDisplayName = $cred.DisplayName
                PasswordCredentialStartDate    = $cred.StartDate
                PasswordCredentialEndDate      = $cred.EndDate
            }
        }
    } |
    Format-Table -AutoSize
DisplayName              AppId                                PasswordCredentialsDisplayName   PasswordCredentialStartDate PasswordCredentialEndDate
-----------              -----                                ------------------------------   --------------------------- -------------------------
Helpdesk Application     gggggggg-6666-7777-8888-hhhhhhhhhhhh Helpdesk Application Password    8/20/2024 7:54:25 AM        11/18/2024 7:54:25 AM
Helpdesk Application     gggggggg-6666-7777-8888-hhhhhhhhhhhh Helpdesk Application Backend     8/7/2024 4:36:49 PM         2/3/2025 4:36:49 PM
Contoso Automation App   bbbbbbbb-1111-2222-3333-cccccccccccc AI automation Cred               5/3/2025 7:03:11 PM         5/3/2026 7:03:11 PM

In questo esempio viene illustrato come recuperare applicazioni con segreti.

Parametri

-All

Elencare tutte le pagine.

Proprietà dei parametri

Tipo:System.Management.Automation.SwitchParameter
Valore predefinito:False
Supporta i caratteri jolly:False
DontShow:False

Set di parametri

(All)
Posizione:Named
Obbligatorio:False
Valore dalla pipeline:False
Valore dalla pipeline in base al nome della proprietà:False
Valore dagli argomenti rimanenti:False

-ApplicationId

Specifica l'ID di un'applicazione in Microsoft Entra ID.

Proprietà dei parametri

Tipo:System.String
Valore predefinito:None
Supporta i caratteri jolly:False
DontShow:False
Alias:ObjectId

Set di parametri

GetById
Posizione:Named
Obbligatorio:True
Valore dalla pipeline:True
Valore dalla pipeline in base al nome della proprietà:True
Valore dagli argomenti rimanenti:False

-Filter

Specifica un'istruzione filtro OData v4.0. Questo parametro controlla gli oggetti restituiti.

Proprietà dei parametri

Tipo:System.String
Valore predefinito:None
Supporta i caratteri jolly:False
DontShow:False

Set di parametri

GetQuery
Posizione:Named
Obbligatorio:False
Valore dalla pipeline:True
Valore dalla pipeline in base al nome della proprietà:True
Valore dagli argomenti rimanenti:False

-Property

Specifica le proprietà da restituire

Proprietà dei parametri

Tipo:

System.String[]

Valore predefinito:None
Supporta i caratteri jolly:False
DontShow:False
Alias:Select

Set di parametri

(All)
Posizione:Named
Obbligatorio:False
Valore dalla pipeline:False
Valore dalla pipeline in base al nome della proprietà:False
Valore dagli argomenti rimanenti:False

-SearchString

Specifica una stringa di ricerca.

Proprietà dei parametri

Tipo:System.String
Valore predefinito:None
Supporta i caratteri jolly:False
DontShow:False

Set di parametri

GetVague
Posizione:Named
Obbligatorio:False
Valore dalla pipeline:True
Valore dalla pipeline in base al nome della proprietà:True
Valore dagli argomenti rimanenti:False

-Top

Specifica il numero massimo di record da restituire.

Proprietà dei parametri

Tipo:System.Int32
Valore predefinito:None
Supporta i caratteri jolly:False
DontShow:False
Alias:Limit

Set di parametri

GetQuery
Posizione:Named
Obbligatorio:False
Valore dalla pipeline:True
Valore dalla pipeline in base al nome della proprietà:True
Valore dagli argomenti rimanenti:False

CommonParameters

Questo cmdlet supporta i parametri comuni: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction e -WarningVariable. Per altre informazioni, vedi about_CommonParameters.