Functions/Get-DiscoveredAppInfo.ps1

<#
.SYNOPSIS
Retrieves the discovered cloud app information for a given stream, app, and time frame.
 
.DESCRIPTION
This function retrieves the discovered cloud app information for a given stream, app, and time frame by making a call to the Microsoft Graph API.
 
.PARAMETER streamID
The ID of the stream to retrieve discovered cloud app information for.
 
.PARAMETER appID
The ID of the app to retrieve discovered cloud app information for.
 
.PARAMETER timeframe
The time frame to retrieve discovered cloud app information for. Must be one of the following: "LastHour", "Last24Hours", "Last7Days", "Last30Days".
 
.EXAMPLE
PS C:\> Get-DiscoveredCloudAppInfo -streamID "1234" -appID "5678" -timeframe "Last24Hours"
Returns the discovered cloud app information for the app with ID "5678" in the stream with ID "1234" for the last 24 hours.
 
.NOTES
This function requires the Invoke-GraphAPI function to be available in the current session.
#>

function Get-DiscoveredAppInfo {
    param (
        [Parameter(Mandatory = $true)]
        [string]$streamID,
        [Parameter(Mandatory = $true)]
        [string]$appID,
        [Parameter(Mandatory = $true)]
        [stream_time_frame]$timeframe
    )

    Begin {
        $streamTimeFrameObject = [StreamTimeFrame]::new()
        $streamTimeFrame = $streamTimeFrameObject.$timeframe
        $ErrorActionPreference = 'Stop'
        $resourceGraph = "https://graph.microsoft.com"
        $discoveredAppInfoEndpoint = "$resourceGraph/beta/security/dataDiscovery/cloudAppDiscovery/uploadedStreams/$streamID/$streamTimeFrame/$appID/appInfo"
    }
    Process {                  
        $response = Invoke-GraphAPI -Uri $discoveredAppInfoEndpoint -Method Get
        return $response.value   
    }
}