Wanted to demo Azure Runbook with daily PowerShell PS1 that send SharePoint storage report email with HTML table and CSV attachment. Features include:
- Hosted on Azure Platform-As-A-Service (PAAS)
- Read source data SharePoint Online (SAAS)
- SMTP for routing email with Exchange online
- Credential storage in Azure Automation secure string
- Logging with full debug
- Local execution with Visual Studio code to debug
Demo covers the creation of local PowerShell PS1 and execute to confirm functionality. Script reads Tenant Site Collection from SharePoint Online leveraging Client App ID and App Secret. Table of collected data is formatted with HTML and CSS then routed out with SMTP.
Cheers.

Source Code
Video
Screenshots









References
- https://medium.com/ng-sp/sharepoint-add-in-permission-xml-cheat-sheet-64b87d8d7600
- https://stackoverflow.com/questions/28352141/convert-a-secure-string-to-plain-text
- https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-pnp/sharepoint-pnp-cmdlets?view=sharepoint-ps
- https://docs.microsoft.com/en-us/azure/automation/shared-resources/credentials
- https://spjeff-admin.sharepoint.com/_layouts/15/appregnew.aspx
- https://spjeff-admin.sharepoint.com/_layouts/15/appinv.aspx