Create a runbook
Create an Azure automation runbook that will export your inventory data from Microsoft Graph.
Get your Proactive remediations script package GUID
For the automation runbook, we'll need to know the GUID of the script package we just created. An easy way to do this is to use the Developer Tools in Microsoft Edge.
In the MEM portal, navigate to Proactive remediations, but before you click on the script package you created, press F12 to open the DevTools. Click on the Network tab at the top.
Then click to open the script package and you'll see the URL/s that the portal is calling. You'll see one with the name getRemediationHistory, for example - right-click on that and copy the link address.
You can then paste it into notepad, for example, and you'll have the GUID that you need in the URL. Make a note of this GUID.
Create a runbook (sending to Azure storage account)
Download the following runbooks script.
In your Azure automation account, navigate to Runbooks and Import a runbook. Browse to and import the runbook script, select the Runbook type PowerShell and add a description.
In the runbook script you'll need to add some parameter values at the top:
$ResourceGroup. This is the name of the resource group that your storage account belongs to.
$StorageAccount. This is the name of your storage account.
$Container. This is the name of the container in the storage account where you'll export your data to (must exist)
$ProactiveRemediationsScriptGUID. This is the GUID for your PR script package that you obtained earlier.
The rest of the script can remain unchanged.
Publish the runbook, then start it. After execution is complete, you should see the CSV file created in your storage account.
On the Edit tab of the blob, you can see your exported data.
For completeness, here's the same data imported into Power BI.
Create a runbook (sending to Log Analytics workspace)
First you'll need to add the WorkspaceID and PrimaryKey from the Log Analytics workspace as encrypted variables in the Azure automation account.
In your LA workspace, go to Agents management and copy the Workspace ID and Primary key.
In the automation account, go to Variables and Add a variable.
Create the following variables as strings and paste in the copied values. Select the Encryption option.
WorkspaceID
PrimaryKey
Now download the following runbook script.
In your Azure automation account, navigate to Runbooks and Import a runbook. Browse to and import the runbook script, select the Runbook type PowerShell and add a description.
In the runbook script you'll need to add some parameter values at the top:
$ProactiveRemediationsScriptGUID. This is the GUID for your PR script package that you obtained earlier.
$LogName. This is the name of the custom log you'll send data to in the LA workspace. It doesn't need to already exist.
As long as your automation account variables are named the same as in the script, you don't need to change those.
The rest of the script can remain unchanged.
Publish the runbook, then start it. After execution is complete, you can query the data in the custom log from the LA workspace. Bear in mind that for the first run it can take some minutes before the data is ingested and available in the workspace.
The custom log name will be appended with "_CL" and only non-null values will be ingested and available to report on.
Schedule the runbook
Schedule the Runbook to execute at the desired 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
Last updated