How can i trigger a cloud discovery through scripts or in flow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 05:42 AM
Hi ,
We are creating Azure resource groups using a catalog item , after sending the data we wanted to run a cloud discovery on the flow , how can we achieve this .
Thanks in Advance..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 06:45 AM
Hi @subin ps1 ,
You can create a script step in Flow designer
and use below code to run discovery
function RunMyDiscoverNow() {
//Enter the IP Adresses in the Array IPAdresses, and comma seperate
//Example: "x.x.x.1, x.x.x.2, x.x.x.3"
var IPAdresses = "10.200.218.27, 10.200.218.99, 10.200.218.191";
var iparray = IPAdresses.split(",");
for (var i=0; i < iparray.length; i++) {
var ipaddr = iparray[i]
//Ensure that a valid MID server name is used as the
//2nd parameter to d.discoveryFromIP
var d = new Discovery();
var statusID = d.discoveryFromIP(ipaddr,'MIDSERVER1');
gs.print("This is the address that was scanned " +ipaddr);
}
}
RunMyDiscoverNow();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 06:49 AM
You can refer below article for more details
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0830714
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 06:51 AM
Hi, try to create a custom action that calls the script invoking a specific schedule, created before.
Link to API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2023 06:59 AM
HI @subin ps1 ,
I trust you are doing great.
To achieve running a cloud discovery after creating Azure resource groups using a catalog item in ServiceNow, you can follow these steps:
Create a catalog item: Set up a catalog item in ServiceNow to allow users to request the creation of Azure resource groups. This item should capture all the necessary information for the creation process.
Create a workflow: Build a workflow in ServiceNow to handle the creation of Azure resource groups. This workflow should include the necessary activities to interact with the Azure platform, such as using Azure APIs or Azure PowerShell modules.
Integration with Azure: Configure ServiceNow to integrate with Azure. This integration involves setting up authentication credentials, such as Azure Active Directory (AAD) service principal, to establish a connection between ServiceNow and Azure.
Azure resource group creation: In the workflow, write the necessary code or use ServiceNow's built-in activities to invoke Azure APIs and create the resource groups. Ensure that you capture the relevant data from the catalog item and pass it to the Azure API calls.
Trigger cloud discovery: After successfully creating the resource groups, you can trigger the cloud discovery process to populate the ServiceNow CMDB (Configuration Management Database) with information about the newly created Azure resources.
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi