Lenovo devices warranty dashboard with Log Analytics
In this post I will show you a dashboard for Lenovo devices allowing you to see warranty status for all Intune devices.
What it does ?
Using this report you can easily see:
- Devices count with active/expired warranty
- Number of days before end of warranty
- Devices with expired warranty (by model)
- Devices with active warranty (by model)
- Devices details with expired warranty
- Devices details with active warranty
- Devices with warranty expired < 1 year
- Devices with warranty expired < 1 month
The solution
- Create an Azure Automation account
- Use it with Managed Identity
- Create a Runbook in Automation
- Runbook get all Lenovo devices info
- Get warranty status for all devices
- Send data to Log Analytics
Sources to download
Click on the below GitHub picture to get following files:
- Runbook.ps1: Azure Automation script
- Assign_permissions.ps1
- Workbook.json: Log Analytics dashboard
- DCR_Table.json: Table to ingest in DCR
Azure Automation part 1
Create the account
1. Go to Azure
2. Go to Automation accounts
3. Click on Create
4. Type a name
5. Choose a Subscription, resource group and region
6. Click on Create
Set Managed Identity
1. Go to your automation account
2. Go to Identity
3. Go to System assigned
4. Select On
5. Click on Save
6. Click on Yes
Add permissions
The script uses Graph API to get all Lenovo devices serial number.
For this you need to add the appropriate permission on Graph API.
Run the script Assign_permissions.ps1 with global admin rights.
Log Analytics prerequisites
Create Data Collection Endpoint
1. Go to the Entra portal
2. Go to Monitor
3. Go to Data Collection Endpoints
4. Click on Create
5. Type a name
6. Choose a subscription, resource group and region
7. The region should be the same than the workspace
8. Click on Review+Create then Create
9. Once created, click on the DCE
10. Go to Overview
11. Copy the Logs Ingestion value
You will need it in the runbook
Create custom log (DCR)
We will proceed as below:
1. Go to your Log Analytics workspace
2. Go to Tables
3. Click on Create
4. Click on New custom log (DCR based)
5. As name type LenovoWarranty_CL
!! Don't change it !!
6. Click on Create a new data collection rule
7. Choose a Subscription and resource group
8. Type a Name
9. Select the DCE
10. Click on Next
11. Click on Browse for files
12. Select DCR_Table.json
13. Click on Next > Create
14. Go to Monitor
15. Go to Data collection rules
16. Go to your DCR
17. Go to Overview
18. Click on JSON View (on the right side)
19. Copy the immutableId value
You will need it in the runbook
Now we need to give the application permission to use the DCR.
For that proceed as below:
1. Go to your DCR
2. Go to Access Control (IAM)
3. Click on Add role assignment
4. Check Monitoring Metrics Publisher
5. Click on Next
6. Check Managed identity
7. Click on Select members
8. In Managed identity, select Automation Account
9. Check your automation account
10. Click on Select
11. Click on Review + assign
Azure Automation part 2
The runbook
The automation script will proceed as below:
1. Get all Lenovo Intune devices
2. Get the serial number, device name, model...
5. Get warranty info through the serial number
6. Send data to Log Analytics
Fill variables $DcrImmutableId and $DceURI in the Runbook.ps1
Create the Runbook
1. Go to your Automation accounts
2. Go to Runbooks
3. Click on Create a runbook
4. Type a name
5. In Runbook type, select PowerShell
6. Select PowerShell 7
7. Click on Create
8. Go to Edit
9. Copy content of Runbook.ps1
Publish the Runbook
1. Go to your Runbook
2. Click on Edit
3. Click on Publish
4. Click on Yes
Schedule the Runbook
1. Go to your Runbook
2. Click on Schedules
3. Click on Add a schedule
4. Click on Link a schedule to your runbook
5. Click on Add a schedule
6. Type a name
7. In Recurrence, select Recuring
8. Click on Create
Log Analytics dashboard
How it looks like ?
The workbook is divided in 2 tabs:
- Warranty resume
- Warranty details
BIOS update resume tab
Warranty status
Purpose: count of devices with warranty active or expired.
Number of days before end of warranty
Purpose: count of devices with active warranty by number of days before the end of the warranty.
Devices with expired warranty (by model)
Purpose: count of devices with expired warranty by model.
Devices with active warranty (by model)
Purpose: count of devices with active warranty by model.
Warranty details tab
Devices with expired warranty
Purpose: devices details where warranty is expired.
Devices with active warranty
Purpose: devices details where warranty is active.
Devices with warranty expired < 1 year
Purpose: devices details where warranty is active and expired in less than 1 year.
Devices with warranty expired < 1 month
Purpose: devices details where warranty is active and expired in less than 1 month.
Add the workbook
In this part we will add the report.
The report can be downloaded on GitHub, link mentioned above.
The report is the file: Workbook.json
To add it, proceed as below:
1. Go to the Azure portal
2. Go to Log Analytics workspace
3. Go to workbooks
4. Click on New
5. Go to Advanced editor
6. Remove all content
7. Go to the GitHub link, there
8. Click on the copy button
9. Click on Apply
10. Click on Done editing then Save
1 commentaire
I followed this and currently it only shows [Intune Device Compliance] [Intune Devices] [InstuneAuditLogs] [IntuneOperationalLogs] and [Usage]. Any Ideas?
Enregistrer un commentaire