#!/bin/bash ## .SYNOPSIS ## HTML Report to consume easily via EMAIL, or from the Report Directory ## ## .DESCRIPTION ## This Script will query the Veeam Backup for Microsoft 365 API and produce a list of Organizations, including if they have Modern Auth enabled or not. Then it saves it into a comfortable HTML, and it is sent over EMAIL ## The Script it is provided as it is, and bear in mind you can not open support Tickets regarding this project. It is a Community Project ## ## .Notes ## NAME: veeam_microsoft365_modernauth_report.sh ## ORIGINAL NAME: veeam_microsoft365_modernauth_report.sh ## LASTEDIT: 14/04/2022 ## VERSION: 1.0 ## KEYWORDS: Veeam, HTML, Report, Microsoft 365 ## .Link ## https://jorgedelacruz.es/ ## https://jorgedelacruz.uk/ # Configurations ## # Endpoint URL for login action veeamUsername="YOURVEEAMBACKUPUSER" veeamPassword="YOURVEEAMBACKUPPASS" veeamRestServer="YOURVEEAMBACKUPFORMICROSOFT365IP" veeamRestPort="4443" #Default Port ## System Variables reportPath="/home/oper/vb365_daily_reports" email_add="CHANGETHISWITHYOUREMAIL" reportDate=$(date "+%A%B%d%Y") ## Login and Token veeamBearer=$(curl -X POST --header "Content-Type: application/x-www-form-urlencoded" --header "Accept: application/json" -d "grant_type=password&username=$veeamUsername&password=$veeamPassword&refresh_token=%27%27" "https://$veeamRestServer:$veeamRestPort/v5/token" -k --silent | jq -r '.access_token') ## # Veeam Backup for Microsoft 365 Organization Overview. This part will check the Organizations ## veeamVB365Url="https://$veeamRestServer:$veeamRestPort/v5/Organizations" veeamOrganizationUrl=$(curl -X GET --header "Accept:application/json" --header "Authorization:Bearer $veeamBearer" "$veeamVB365Url" 2>&1 -k --silent) #Generating HTML file html="$reportPath/Microsoft365-ModernAuth-Report-$reportDate.html" echo '' >> $html echo "" >> $html echo "
" >> $html echo 'Organization Name | " >> $html echo "Region | " >> $html echo "Service Account | " >> $html echo "Modern Auth EX | " >> $html echo "Modern Auth SP | " >> $html echo "Last Backup | " >> $html echo "
---|---|---|---|---|---|
$OrganizationName | " >> $html echo "$OrganizationRegion | " >> $html echo "$OrganizationServiceAccount | " >> $html echo "$OrganizationMAEX | " >> $html echo "$OrganizationMASP | " >> $html echo "$OrganizationLastBackup | " >> $html echo "