Automate Data Export to Azure Storage Account
Below is an example PowerShell runbook that can be used in an Azure automation account to export data from Microsoft Graph to an Azure Storage account as a CSV file. It exports Windows devices with a selection of fields.
The following is assumed:
- You have enabled a system managed identity for the Azure automation account and granted it the appropriate API permissions to Microsoft Graph.
- You have assigned the managed identity a role with the appropriate permission to upload and modify blobs in the storage account.
You need to provide the following as variables in the script:
- $ResourceGroup - the name of the resource group containing the storage account
- $StorageAccount - the name of the storage account
- $Container - the name of the container which will hold the exported file