Microsoft intune spoke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2024 10:31 AM - edited 06-24-2024 10:46 AM
OMG!!!! The Service Graph Connector for Microsoft Intune is licensed!
How will I bring intune devices into Servicenow 🤔
💡Here's how you can, if your system already has 'IntegrationHub' subscription:
Below are the steps to bring Managed devices into your ServiceNow instance
STEPS:
1. Navigate> Plugins> Install 'Microsoft Intune Spoke [sn_ms_intune_spoke]
2. Switch application to 'Microsoft Intune Spoke' after installing
3. Navigate to Integration Hub > Credentials
Create New:
Name: Give name of your choice [For eg., MS Intune Creds]
Active: True
Oauth Entity Profile : Microsoft Intune [Create new if oauth profile doesn't exists]
Details for oauth entity profile creation:
Name: Microsoft Intune
Oauth Provider: Microsoft Intune platform [Please request Client ID, Client Secret, Tenant from intune end and create oauth registry using Navigate> Application registry]
Grant Type: Client credentials
Is default: True
Oauth Entity Profile Scopes:
Oauth Entity Scope: Microsoft Graph Entity Scope
Oauth Scope: https://graph.microsoft.com/.default
After attaching entity profile click on 'Get OAuth Token' UI Link in Credential record
4. Navigate> > IntegrationHub>Connections & Credentials
Create new:
Name: Microsoft_Intune [Name of your choice]
Type: Connection & Credential
Connection Type: HTTP
Click 'Save'
5. In Related List> Connections> Create new:
Name: Give name of your choice [For eg., MS_Intune_Connection]
Credentials: Attach creds created from Step 3 [MS Intune Creds]
Connection Alias: Attach connection created from Step 4 [MS_Intune_Connection]
Connection URL: https://graph.microsoft.com
Attributes> Version [beta]
6. Navigate> Flow designer> Action
Create new Action:
Name: Give name of your choice [For eg., Look up Intune Managed Devices]
Step A:
Inputs: Filtering On [Type: choice], Filter Value [Type: String]
Step B:
Action Preprocessing: Enable preprocessing script: True
Step C:
Pre Processing Script: Pass the Input Variables from Step A
Script: Sample script
Step D :
Request: How will you get data: REST Step
Enable pagination: True
Step E:
Pagination Setup Step
Pagination variables:
i) Name: getNextPage
Initial Value: false
Next Value from: Script
ii) Name: odatanextlink
Initial Value:
Next Value from: Response Body
iii) Name: skipToken
Initial Value:
Next Value from: Script
Pagination variables Script:
(function paginate(variables, pageResponse) {
try {
var odata_nextlink = variables.odatanextlink;
Step F:
REST Step :
Look up Managed Devices:
Connection Details:
Connection: Use Connection Alias
Connection Alias: Attach connection created from Step 4 [MS_Intune_Connection] (Use ID of connection)
Base URL: https://graph.microsoft.com/beta
Request Details:
Build Request: Manually
Resource Path: /deviceManagement/managedDevices (Confirm with Intune)
HTTP Method: GET
Query Parameteres:
Name: $top Value: 500
Name: $skiptoken Value: Input from Step E >Skip token
Name: $filter Value: Input from Step C > Filter
Step G:
How will you identify each record: JSON/XML Splitter
How will you parse each item into object: Script Parser
Step H:
Splitter Step:
Source Format: JSON
Item Path: $.value
Step I:
Script Parser Step:
Sample script:
7. Navigate> System Import sets> Data Sources
8. Create new Data source:
Name: Give name of your choice [For eg., Intune Managed Devices]
Import set label : Staging table name you want devices to be loaded [ For eg., Intune Managed Devices]
Import set name: u_intune_managed_devices [backend name of staging table]
Type: Data stream (IntegrationHub)
Data in single column: uncheck
Use Batch import: uncheck
Data Steam action: Select the action created in Step 6 [Look up Intune Managed Devices]
Data Stream action inputs
Filtering on: select values in dropdown based on your data to be filtered and bought into servicenow. I kept as none since no filtering was required.
Filter Value: Value of the filter selected (For eg., If selected Operating System the value is Windows)
Click on load all records [Test load before full load]
9. Create transform map
Name: Give name of your choice
Source table: Fetch from Step 8: u_intune_managed_devices [Staging table]
Target table: Computer [cmdb_ci_computer]
Script:
log.error("Model ID Cannot be empty or Unknown for serial number " + source.u_serialnumber + " and the ID is " + source.u_id);
Map fields using Field map
10. Navigate> Computer[cmdb_ci_computer]> Open dictionary entry for 'Discovery source' field
Create new choice: Intune-Spoke [If choice doesn't exists]
11. Navigate> Scheduled Data import
Create new: Microsoft Intune Managed Devices import
Data source Attach data source created in Step 8: Intune Managed Devices
Run As: System Admin
Run: Daily
Configure schedule import as required.
Please help like and mark helpful if the post did benefit you 🙂
Happy Learning!!!!!
- 2,513 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2024 12:36 PM
Hello, great writeup! I'm doing something similar. For the pagination, you are getting odatanextlink from the response body, can you share what you put in the "Expression" field?