smsagent.blog
  • docs.smsagent.blog
  • Custom Reporting in Microsoft Intune
    • Delivery Optimization Report
    • Windows Update for Business Custom Reporting
      • Power BI Report Walkthrough
      • Known issues / limitations
      • Change log
      • Deploy the solution
        • Create Azure Resources
        • Configure Azure Resources
        • Deploy the client-side script
        • Deploy the Azure automation runbooks
        • Configure the Power BI report
      • Adding additional language support
      • Table schema reference
    • Automating Data Exports from Microsoft Graph
      • Azure Automation account
        • Create / configure an Azure automation account
        • Grant API permissions
        • Create an Azure automation runbook
      • Azure Storage account
      • Automate Data Export to Azure Storage Account
      • Automate Data Export to Azure Monitor Logs
      • Creating / Troubleshooting Runbooks
      • Power BI
        • Connect Power BI to an Azure storage account data source
        • Connect Power BI to an Azure log analytics workspace as a data source
    • Managed Devices Report
      • Create / configure an Azure automation account
      • Grant API permissions
      • Create / configure an Azure storage account
      • Create an Azure automation runbook
      • Create a PowerBI report
      • MEM Managed Device Report template
      • Bonus! Unhealthy MEMCM Clients email report
    • Intune Assignments Report
      • Create / configure an Azure automation account
      • Grant API permissions
      • Create / configure an Azure storage account
      • Create an Azure automation runbook
      • Create a Power BI report
      • Change log
    • Patch My PC Report
      • A look at the Power BI reports
      • Change log
      • Video guides
      • Things to know
      • Create / configure an Azure automation account
      • Grant API permissions
      • Create / configure an Azure storage account
      • Create an Azure automation runbook
      • Create the Power BI report
      • Feedback
    • Windows 11 Hardware Readiness Report
    • Gathering Custom Inventory with Intune
      • Set up the Azure Resources
      • Create a Proactive remediations script package
      • Create a runbook
  • PowerShell Scripts Online Help
    • Get-AzSubscriptionActivityLog
  • Azure Solutions
    • Automated Azure Table Storage Backups
      • Change log
      • Deploy the solution
        • Create the Azure resources
        • Set the backup schedule
        • Add storage tables to the backup
        • Add role assignments to the storage account/s
        • Create a lifecycle management rule
      • Run a manual backup
      • Restore a backup
Powered by GitBook
On this page
  • Download the Runbook script
  • Configure the script
  • Create the Runbook
  • Schedule the Runbook

Was this helpful?

  1. Custom Reporting in Microsoft Intune
  2. Patch My PC Report

Create an Azure automation runbook

Here we will create a runbook in the automation account that will retrieve data from Microsoft Graph using the REST API and export the data to the Azure storage account.

PreviousCreate / configure an Azure storage accountNextCreate the Power BI report

Last updated 1 year ago

Was this helpful?

This process uses the .

The Az.Accounts and Az.Storage modules are required to execute this runbook. If you wish to use a System-generated Runtime environment, you should be fine as the Az modules are already included. If you use your own runtime environment, make sure the Az modules are included.

It is highly recommend to use the latest PowerShell Core runtime version to execute the runbook (7.2 at the time of writing)

Download the Runbook script

Download the runbook from my GitHub repo.

Configure the script

In the runbook script, set the first four variables in the Variables script region at the top.

$ReportType. Specify "Overview" to just export the data required by the Overview report, "Detailed" to just export the data required by the Detailed report, or "All" to export both.

$ResourceGroup. Enter the name of the Azure resource group containing your Azure storage account.

$StorageAccount. Enter the name of the Azure storage account.

$Container. Enter the name of the Container in your storage account where you'll be exporting the data.

Create the Runbook

  • Click on the Runbooks pane and choose Create a runbook

  • Choose Browse for file and locate the runbook script file

  • Select a Runtime Environment

  • Enter a Description if desired, and click Review + Create, then Create

  • In the Edit PowerShell Runbook window, Publish the runbook

Schedule the Runbook

Schedule the Runbook to execute at regular intervals to keep the data updated.

  • In the Azure portal, in the automation account, open the Runbook you created

  • Click Link to schedule

  • In the Schedule section, select an existing schedule or create a new one

Runtime Environment experience
Export-MSGraphPatchMyPCData.ps1