Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Intune Integration with ServiceNow

Asish17
Tera Contributor

We are integrating our ServiceNow instance with Intune application, 

https://www.servicenow.com/community/cmdb-forum/intune-integration-with-servicenow/m-p/2555215

by following the above URL done the required part mentioned, can you please guide us what we have to do next to proceed further.

 

Thanks,

Asish

1 ACCEPTED SOLUTION

Tai Vu
Kilo Patron
Kilo Patron

Hi @Asish17 

Once the App Registrations configuration has been done in Azure. You can come back to ServiceNow, define a new Application Registries type OAuth Provider. Then, update required fields to match your Azure tenant and ServiceNow instance.
1. Client ID: <Application (client) ID>
2. Client Secret: <client_secret>
3. Authorization URL: https://login.microsoftonline.com/<Directory (tenant) ID>/oauth2/v2.0/authorize
4. Token URL: https://login.microsoftonline.com/<Directory (tenant) ID>/oauth2/v2.0/token
5. Token Revocation URL: https://login.microsoftonline.com/<Directory (tenant) ID>/oauth2/v2.0/token
6. Redirect URL: https://<instance_name>.service-now.com/oauth_redirect.do

 

Now, ensure that the Entity Scopes and Entity Profiles are properly set up.

Screenshot 2024-04-01 at 17.09.55.png

Screenshot 2024-04-01 at 17.10.06.png

 

Finally, we create a new Credential and link to the Profile created above.

Screenshot 2024-04-01 at 17.10.45.png

 

To test the connection, utilize the related links to Get OAuth Token. A message will confirm successful authentication.

Screenshot 2024-04-01 at 17.12.12.png

Finally, we can now use Access Token from the Credential to authenticate API requests or you can also utilize the Credential inside Flow Designer through Connection & Credential Aliases.

 

Cheers,

Tai Vu

View solution in original post

6 REPLIES 6

Hi @Asish17 

You can utilize the Microsoft Graph APIs to retrieve data from Intune. Sample below:

List managedDevices

 

GET https://graph.microsoft.com/v1.0/deviceManagement/managedDevices

 

 

Just make sure you pass the Access Token to the Request Header. (or you can configure the Connection & Credential Aliases within the Flow as mentioned above)

Header Value

AuthorizationBearer {token}. Required.
Acceptapplication/json

 

Cheers,

Tai Vu

@Asish17 

Sample for the scripting part by the way.

 

var token = '<access_token>';
var reqEndpoint = 'https://graph.microsoft.com/v1.0/deviceManagement/managedDevices';
var sm = new sn_ws.RESTMessageV2();
sm.setEndpoint(reqEndpoint);
sm.setHttpMethod('get');
sm.setRequestHeader('Authorization', 'Bearer ' + token);
sm.setRequestHeader('Accept', 'application/json');
var response = sm.execute();
var body = sm.getBody();
var code = sm.getStatusCode();

gs.info(body);
gs.info(code);

 

 

Regards to Flow Designer, you can have a look into Configure a connection in the Connections dashboard. (It requires Integration Hub activated)

 
Cheers,
Tai Vu