I'm new to Azure and powershell. I have some very basic knowledge of both and some scripting experience but not in powershell. Goal : Get list of applications from Azure and all available associated information. Specifically creationdate. Output in CSV.. Applications created in the last 60 days
and https://docs.microsoft.com/en-us/powershell/module/azurerm.resources/get-azurermadapplication?view=azurermps-6.13.0 this I havent got to work at all but seems like what I want.
$ClientID     = "XCXXXXXXXXXXXXXXXX"
$ClientSecret = "XCXXXXXXXXXXXXXXXX"
$tenantdomain = "XCXXXXXXXXXXXXXXXX"
$loginURL     = "XCXXXXXXXXXXXXXXXX"
$resource     = "https://graph.microsoft.com"
$path = "C:\Scripts\objects.csv"
$headers = "App Name,CreatedOn"
# body for the rest request to get an access token
$body = @{grant_type="client_credentials";resource=$resource;client_id=$ClientID;client_secret=$ClientSecret}
# get an access token
$oauth = Invoke-RestMethod -Method Post -Uri $loginURL/$tenantdomain/oauth2/token?api-version=1.0 -Body $body
# if we have an access token, then make the graph call
if ($oauth.access_token -ne $null) 
{
    $headerParams = @{'Authorization'="$($oauth.token_type) $($oauth.access_token)"}
    $url = "https://graph.microsoft.com/beta/applications?select=createddatetime,displayname"
    do {
        $response = Invoke-WebRequest -Uri $url -UseBasicParsing -Headers $headerParams -Method GET  -ContentType "application/json"
        if ($response.Content)
        {
    
