VETS Webinar - ServiceNow MID Server Deep Dive 2023-08-11
well thank you everyone for joining we'll give uh everyone a couple minutes just to get in I know it's around lunchtime on the West Coast thank you all for joining though we'll get started in just a couple of minutes here foreign thanks again everyone for joining we'll get started here in about one more minute all right well again welcome everyone thanks for joining this is something that I've been wanting to get out for quite a while uh and is very near and dear to my heart um let's see here uh we don't have a ton of slides we're going to get through a couple slides talk about how the mid-server is kind of configured what it does um a little bit of what we're not going to go into setup today at all this is really more about what a midserver does how it works how it communicates with an instance and what you can do uh with a mid-server to kind of extend everything else that you're doing with the servicenow platform um let's get through some of the the niceties so um like I said we're going to talk about some of that uh we'll talk about flows and how they work with the mid server because it's a little bit different uh than how we traditionally worked with the mid server many years ago and then my favorite subject custom code execution on the mid server um we may not get through all of this part uh the custom Java jar code file um we may have to put off till the next one because I want to leave some time for Q a at the end but we shall see um so first off a little introduction my name is Chris Nanda I'm a manager of Technology here at vets I've been doing software development for about 20 years now or so but I've had 14 years on the servicenow platform I spent five of that at servicenow and core platform engineering and I also had the honor to start customer success at servicenow I owned my own services company before and then left there to go on board at servicenow and then now I'm here at vets but I'm very passionate about the platform um deeply into the technology side ever since I started working on the platform I started decompiling the mid-server uh working through some of the code that the admit server is actually built off of and figuring out different ways that we can use it because the mid server allows us to do some interesting things that we can't do on the instance um that being said a lot more has been added to the the servicenow instance over the years but things like the PDF generation that you can do now and other things along those lines that uh we didn't have apis for back in the day uh were all things that we could then do through the mid server through some custom execution so this was very prevalent at that point and then now as more organizations are adopting service now and porting Legacy applications or disparate applications within an organization there's going to be pinpoint needs to be able to do some custom connections or custom code execution uh with certain things that you want to do on the platform and you know traditionally the answer to that is well you just can't or maybe you find another SAS application that you can connect to um but unfortunately or but fortunately we have the ability to do some custom execution uh through this but first off let's start off with communication um the mid server is a little bit of a misnomer um mid-server is really a mid-server service or a mid-server application and what that means is it's an application that servicenow provides that allows uh you to add this service or application onto a Windows server or Linux server within your infrastructure whether that is a private Cloud let's say or on-premise data center and it allows for functionality to so that servicenow can access resources within your infrastructure so most common ones that you've probably seen are active directory SCCM um maybe some rest applications that you have Exposed on your in intranet or within your network infrastructure the other common one is Discovery all of these things go through the mid server and essentially what's happening there is the mid server is using polling to to ask servicenow for work to do but we'll get into a little bit more about that in a second um the nice thing is all of it's over Port 443 https so nothing has to be opened up on your firewall that isn't normally accessible um from devices inside your network network infrastructure to the outside internet um or I should say that it isn't easily available because these days with zero trust you know we want to make sure only things have access to call out that are actually granted access um some of the the typical things are uh let's see rest Discovery soap Integrations um those are probably the most common that go through the mid server uh but outside of that the nice thing is we have the ability to do just about anything else as well um the architecture so for those of you who are uh kind of more developmentally inclined the mint server uses a publish And subscribe mechanism um utilizing the bay ux protocol on top of comet D basically all of that is just a bunch of uh names for the midserver calls out and looks at a particular messaging queue to get work to do and then downloads whatever that message says and then goes out and executes that the queue that it's looking at is called the eccq eccq uh when it comes to servicenow is as simple as just another table in the end the ccq is no different than any other table within servicenow um and it's it's kind of an interesting concept because they just happen to use this one table as the messaging queue for the mid server um but it has a lot of power and something actually came up on LinkedIn just yesterday that I'll touch on at the end of our conversation here around security which is something that um you know I've considered before but it's even more of an issue today than it ever has been um some of the things that service now has changed over the years uh 10 12 years ago uh everything went through the eccq um pretty much was all in plain text uh Basics D4 encoded for a lot of stuff but um all in all it was usually in plain text so we even had to send credentials through the mid-server uh through the ECC queue to the mid-server um pretty soon after that and one of the the first updates that servicenow did on the mid-server were credential stores and so now when you store credentials within your servicenow instance we don't have to worry about those credentials going out through the eccue and plain text the mid server will actually do a connection back to the instance to pull down the credentials that it needs so that way they're always held secure you never have to worry about them getting converted into plain text in transport over to the mid server because like I said when you're looking at the UCC queue it's just an XML payload and and we'll take a look at that in just a few minutes but um ultimately it was very insecure at that time there are certain instances that you'll still see some of that actually you'll see a base64 encoded authorization value in very limited but in certain circumstances you'll still see that going through the mid server all right that's all for for PowerPoint so no Death by PowerPoint today let me go ahead and switch over to an instance and we'll start talking about the good stuff um let's see where we will start with the ECC Cube this is a fairly informal webinar you'll probably notice so like I said I want to do a lot of q a at the end um and see what you guys want to know right now what we can get to in another follow-on video and then anything we can't discuss during this uh session I will follow up with answers either um out on a website or in a follow-on video because I want to do quite a bit more when it comes to mid-servers because they're it's really a cool uh option for us uh so eccq this is this is what it looks like like I said it's just another table but you've got some key aspects um that you need to take note of excuse me so the agent is going to be the emit server that it's going to go out to and what you'll notice sometimes is things will get get duplicated in here none of these should be duplicates but when you've got clustering configured what will happen is a record will get created in the ECC queue as pointing to the cluster and then servicenow will then uh operate on that to determine what mid-server within that cluster it actually needs to get the message and then re-insert a new message within the the eccq just to that particular mid-server so that's kind of a very simplified way of how clustering Works um I I actually don't see a lot of people doing clustering these days it's really good for failover when you've got critical services in production but I I don't see a lot of people talking about it or utilizing it in production these days so I'd be interested to know um you know what everybody's take is on that down the road but anyway then you've got your topic name and Source these are kind of going to be the the next three major um pieces of information that you need going through the eccq because it pretty much is what controls what is going to happen through the eccu um and just remember the reason I'm starting with this is when you're using flow designer when you're using orchestration the old you know based off of workflow if you're using rest message so if you're in a rest message record and you choose use midserver in the end everything is going to go through here if it's going to the mid-server and so when you're debugging um one of the first places I always go and look is straight to here because you're going to be able to see what is being sent to the mid server and one is coming back from the mid server so if you're getting errors in your rust message or whatnot or errors in your flow a little bit different but we'll talk about that or errors in other places you can usually come here just to find some of that debugging information that you might need but from what we can see here you can see that we've got a topic called rest probe here and then a name called get and a source which is an IP address with a an endpoint this just happens to be I've got security operations set up on here with a Splunk connector and so this happens to be a rest probe that is being used that gets sent out to query Splunk for certain information but it's it's interesting because these aren't aren't just random pieces of information this actually controls what is the admit server is going to do and so when the mid server goes out and pulls that message down it's going to first look at the topic it's going to say all right what am I supposed to do this is essentially the probe that that it's going to operate on a probe traditionally uh in servicenow is anything that that the mid server needs to execute um if you're familiar with Discovery you maybe remember probes and sensors it's really the same type of idea a probe is something that goes out to the mid server to go execute or go do something and then the in Discovery the sensor is what processes the data when it comes back and so uh back in the day we used to create probes and sensors as a script include to create this message so I'd have a script include that put together an XML payload and I'll dig into this in just a second but it would put together an XML payload to generate this uh uh record in the UCC queue and then I would have a Biz an async business rule on the the eccq so that when that the result or um output or sorry in this case input record comes back from the mid server to servicenow it would then execute and I could process what comes back but it was really nice and it's even easier now uh because then I could do some some custom functionality on the mid server then when that data gets returned I can operate on that data so let's take a look at what these look like I'm going to open up both of these one thing you'll notice when I get over to here is the queue you've got an output and an input and then a state key thing for this is output queue is what the mid server is going to pick up to go do the input queue is the result of that operation and what you will have is a response to and you can see here that I have this input record and this output put record and the input record has a response to and that is a ref reference to This Record here all right so we're going to look at the output first so the the output of this is kind of interesting it's just an XML payload it gives us some information that's encoded uh the reason it's encoded is because it's an XML payload and uh these days most people don't like XML even servicenow so when I was at servicenow we would usually just encode a JavaScript object and then put that JavaScript object um URI encode it and then put it into an XML payload so so that way it's a little bit easier to pass back and forth just as a side note completely mid server separate you can do the same thing through Glide Ajax because all that's over XML but you can encode a JavaScript object and then send that back and forth so that way you can send some complex objects but here um and let me see if we can pull this up so this isn't a very nice view of it but I can pull up the XML view of this and this is what that XML payload looks like it's essentially just a bunch of parameters that get passed and then the mid server gets to choose what it what it's going to do all of the mid server probes are fairly well not all most of the mid-server probes are fairly Dynamic meaning that because the message gets to determine what's going to be executed and because the Java the runtime can load up lib or jar files libraries on Startup you can have different sets of Jar files on the mid server and then restart your mid server and then it will load those jar files and then they'll be available to the runtime then when a message comes down with a particular type of probe your code will be executed in this case it's a rest probe we can see here I've got a password right here that is being sent this is the what I'm talking about so there's a couple different ways that credentials can get passed number one is this encryption value so servicenow has a built-in encryption system now for uh most of how it's going to pass in-line passwords but then it will also um execute it against the the credentials table so that way if you're running like Powershell and things like that um it will go out and grab those and try multiple Powershell or uh Windows credentials um we can see here that we've got our message headers message parameters um skip sensor this is a common one now it used to be less common to see in the platform because sensors are like I was mentioning before a sensor is what the platform was going to do to process the data coming back from a probe well servicenow has made tons and tons of updates since uh this was originally introduced and since probes and sensors were originally introduced so now most of the the responses you're going to see is actually going to say skip sensor because something else within the platform is going to be watching for that and and operate on the results that uh that come back and there's some even more interesting things that I'll talk about in a little bit but um it's actually gotten pretty intricate so um then you've got a source which this is the same thing that we saw in the uh in one of the other columns on the eccq record but it's the source this is what's actually gonna it's going to try and execute against so I just did a simple or this is just a simple get request that's going out to get data from this particular endpoint our HTTP method and I'm not going to go through every single one of these but ultimately you've got your Source table and Source record and then we also should have our oh no this is the output um so yeah so that that's going to be the output record and then the mid server is going to come in pick this up and then go execute on this saying okay well this is a rest probe it's going to then dynamically load the class for rest probe into uh its process function within the primary probe execution on the mid server and then run whatever it needs to based off of the content that it finds in this message so then our input record looks a little bit different um let me pull this up here it is actually a XML payload that has an XML payload in it so an encoded XML payload um so you can see here we've got a result object and an output if you go and decide to build your own let's say a JavaScript probe so you want to just run some JavaScript using uh some some custom code you've written or something like that on the mid server and you want to write a sensor you still can do it in the same way that we used to which is a business rule on the ccq you want to make it async otherwise it's going to be blocking on the table and then you'll just use XML document 2 to parse out this result object and then you would um you'd use it first to parse this out and then you'd have to decode this particular XML payload as well and then use that it's a little annoying but um nice thing is we don't really have to do that anymore and then we've got a whole bunch of other information about the requests the HTTP headers we've got response information a lot of this um is in support of being able to use this the out-of-box rest message type of thing our object so that way we can log exactly what's going on with those requests but this is really where um if I'm doing anything with the uh with a midserver um you know rest messages if I'm doing Discovery or even if I'm setting up an SCCM service graph connector which goes through the mid server that is a jdbc probe and then goes out and execute SQL you can look at all of that here and actually see the data flowing back and forth and see the rows coming back into the cccue all right let's move on a little bit here because I want to get into flow designer here pretty quickly but first I'm going to show you something that's kind of cool this is something that's locked down on most instances it didn't used to be um I'm not 100 sure why servicenow decided to lock it down to maint um but this is essentially a mid-server scripts script background so just like you can ex execute freeform scripts on uh an instance this is how you can execute a freeform script on the midserver um and I I jumped over something so I do apologize so let me talk about this a little bit uh the the mid server itself is a Java application I kind of mentioned that earlier um servicenow as a whole the servicenow platform uses a JavaScript framework uh execution framework called Mozilla Rhino um I'm not even sure we can really attribute it to Mozilla anymore ultimately because servicenow has maintained it and made updates to it uh severely over the years but the mid server has a subset of that execution on it um from my knowledge up to this point and I'm going to do some more testing but I don't believe any of the scoped application changes have been pushed down to the mid-server uh Rhino execution framework um one of the key things that's really nice is most of the packages calls that we used to be able to do within servicenow are still available on the mid-server and then what that means is um well first let me show you this so Ms is the mid-server so just like we have the GS object in servicenow I can execute this and it's going to go out to the mid server and come back and it shows it to me just as if it executed it on the instance but that actually went out and executed it on the mid server and returned the result to me and I can go take a look at my cues and I see here it executed a script system command and I can see my input right here and so the output is script test just like you would see in Scripps background um so this is a really useful feature so again I'm not 100 percent sure why servicenow uh locked it down but if you I am not going to go into on this recording how you can gain access to it there are ways to do that and I I would suggest if you're testing things out that's the only time I would really ever enable it but it's a really nice testing tool when I'm building out mid-server script includes so um so ultimately the mid Server Like I said is running a baseline version of this rhino framework so it allows us to run JavaScript on the mid server um that in and of itself is nice but because of the fact that it's not locked down um meaning because this this rhino framework is built on Java and ultimately all of your JavaScript code and this is the same thing that happens in service now is actually getting compiled into Java byte code regular Java byte code because that's happening when on on the mid server because it's not locked down we have the ability to execute um Java functions so we we can create instantiate uh Java objects we can um here let me give me one second here because I my one of my browsers closed right before I was in this uh I just need to get my exact code here let me go back here and so VAR Str equals new packages.java DOT Lang dot string Ms DOT log Str this should return to me tester but it's doing it based off of an actual Java object string so instead of having to be confined to the Java JavaScript functions in JavaScript objects I can get actual access to the Java runtime doing this this opens up so many doors to us servicenow does this and you can see in uh not that one here these are called mid-server Script includes just like your instance script includes these are defined as a class using the Prototype server but um let's find a good one I apologize I should have had one of these already ready to go but um yeah let's use AWS API command so just like our um instant side script includes you can see here it does a AWS API command class dot create but then you can see here all of these packages objects because we can access everything from the Java runtime string map mid config parameter stuff from Apache basically not basically anything that is loaded into the Java runtime for the midserver application can be accessed through JavaScript and I know this sounds uh or may sound if you you've never really thought about a need for it or or thought about what you might be able to do with the mid server but this basically opens up any door you possibly want to be able to execute uh code on the mid server to the point where I've actually written a web server running on the midserver meaning inside of the servicenow mid server application I wrote a ongoing service which opened up Port 80 and received requests and passed those requests back to the the servicenow instance um this was I've never had to do it again but um back in the day uh not Citrix but um one of the support companies that did uh devices that were on premise for remoting so that support the help desk could remote in it wasn't the go-to's or anything like that uh it didn't support any type of authentication but they wanted to integrate with servicenow and it was on premise and so one of the options was to open up a uh at that and and this was a long time ago open up a processor on servicenow that was open authentication meaning no authentication which I was not con I wasn't going to do and so essentially what I did was I wrote a web server that was running inside the mid server which it would connect to and then the mid server would pass that data back up so even though it it technically was unsecured because of the fact that it was HTTP protocol but it all stayed within the customer's Network infrastructure so at least was more secure I wouldn't say it was Secure but anyway um now all of this is leading up to one thing that I I really think is is the the kitten caboodle that service now has done for us because I can write my mid-server script includes to do uh some code I can go and create my own Java jar files and I can come here to mid-server jar files and upload my jar file that I've created so I can write my custom Java code I can do my normal software development process and lifecycle testing all of that stuff and then I can upload that jar file here it will then get synced with these the the mid server all of your mid servers actually automatically and then and load that jar file into the runtime and then I can access all of the the classes that I've created within that jar file from my script include now from there we get to flow designer and I'm really really happy servicenow did this because it makes it so much easier and I'm gonna I'm gonna start off by looking at an out of box one then I'll show you the test one that I I was just showing on my screen but one of the utilities that servicenow did and this is exactly the the type of utility that I've been doing for years on servicenow that I love is using the mid server to do things I just can't do on the instance um like zipping files and so servicenow has added utilities this is a um an out-of-box integration Hub utility pack uh that service now has but it basically you define your zip file what you want to be in it you saw all the files that need to go into this ZIP file and then it sends the information down to the mid server and the mid server is actually doing the zipping of it and then sends it back and so you can see here this is an action so I'm not going to go too deep into flow designer and how it works but you can see up here this is an action for anyone not familiar with flow designer essentially you have flows which are multiple actions put together to define a process you have subflows which are reusable sets of those which are multiple actions that Define a process that can then be embedded in another flow and then the actions are the individual things we want to do um such as make a rest call or build a zip file and so in this case one of the steps that you can use is build zip and you can see here at the top there's a required run time so let me just switch over here the default is instance and so this is the default uh required runtime when you use this script step these are called steps so in an action you have multiple steps um maybe I can do a flow designer webinar next uh if we want to get into custom stuff on here but ultimately a script step is it one part of this action is it goes out and executes the script well the key thing here is I can choose midserver and then pass in the mid server or it can do it auto choose any of that the stuff that I want to do here but now automatically for me it's going to execute this script right here on the mid server just like I was doing from that midscripts background before and so I can build this into my flows automatically or or easily and then it'll automatically executed on the mid server and return the results to me and so I don't have to do all of the stuff that I had to do 10 12 years ago you know creating a sensor putting it on the ccq um uh you know processing all of the results and things like that myself is done for us right here um and the results then get returned to the mid-server so this is I'm I'm looking forward to because I just started playing around with the this functionality in the flow designer um a couple of months ago and I'm really looking forward to seeing what I can do with this because like I started off my our conversation or our uh our presentation here with um you know some of the things that we used to have to do are like PDF generation or in this case zip generation if you need to do certain functionality that your developers do today or if you're looking to Port uh applications that you currently have in.net in Java etc etc into servicenow you can do that far easier because you don't have to worry about losing functionality in the end um so that that that is just absolutely huge to me um all right so last thing with code we're going to get away from JavaScript and Java and we're going to move into um Powershell so I'm I'm gonna only lightly touch on Powershell right now because uh I want to do a whole nother webinar on just Powershell and net and all of this stuff but the same type of thing can be done in in Powershell so the mid server connects it has a built-in runtime for JavaScript Rhino but it also can execute Powershell unfortunately servicenow hasn't updated yet I'm waiting on a response back to see if it's on the the road map but Powershell still only works on Windows even though the actual Powershell 7 is uh cross-platform at this point um to actually execute Powershell right now is only on the window on Windows and inside the code uh on the mid server it actually checks to see you know if you're trying to execute Powershell it checks to verify you're on Windows um otherwise it'll error out but um it is the same type of thing where if I uh want to execute Powershell I have the same tools at my disposal uh let me go over here so the names are a little weird so I just want to call this out mid-server script includes our JavaScript they're just like my instant side script includes mid-server script files are Powershell script files again back in the day I actually was able to use the jar files that I would that I was showing you that table that syncs with server syncs with the mid server it's fairly non-discriminatory and so um before mid-server script files existed we would actually use jar files to sync Powershell scripts to the mid server but this is where you're going to find everything from back in runbook automation then orchestration and now flow designer you'll find all of the Powershell scripts here in mid-server script files and you can see I've got lots of different things that are even duplicative because some of them are from the spokes some of them are active directory from orchestration we've got SCCM spoke I think I've got some of the additional orchestration stuff here here's the original Powershell uh orchestration utilities from for workflow and things like that [Music] um but again so same type of thing if I go back to flow designer uh where is it if I add a step here I think I've got it good some of these aren't installed by default and you've got to install them in packs so if you end up not seeing some of these steps I know rest is one of them I think Powershell and there's a couple other steps that don't come by default on the platform sometimes so you have to actually request those plugins be installed um just in case if you're trying to build these but same type of idea here now Powershell doesn't give me the option uh to run this anywhere other than the mid server because of the fact that um I I can't run Powershell on servicenow because it's a it's a Java application and that would actually be fairly uh insecure so from here then though I can choose my midserver script file if I want or I can do it inline script and it's really up to you how you want to do it I like using the script file mainly because then I can um and actually this is why I want to do a whole uh webinar just on this uh you can configure a Powershell environment to mimic the midserver because the mid Server doesn't just go and execute your script file it doesn't literally just take your script file that's that's in here and send it down to to be executed it'll send it down to be executed but what servicenow does is there's multiple wrappers uh Powershell wrappers that happen around your script that execute first and some of the the things about trying to debug Powershell when it's running on the mid server you'll get errors in the wrapper or you'll get errors in your code which is it it's kind of difficult and annoying to debug so what you can do is you can set up an environment that um actually loads up all of those Powershell scripts that servicenow does and executes it in the exact same way that the mid server does that way you can test in that way it I found this out a little while ago when I was doing some active directory stuff and it made my life so much easier so I'm going to do another either a webinar or a video on that a little bit later um one last thing I'm going to add because there's one other thing I want to talk about and show um but when it comes to Powershell Powershell is built on.net so so microsoft.net anything that's built in.net can be run from Powershell so this is why I was saying before all of you the people that you may have internally that are doing Java development or net development you can port a lot of your code to be functional still even it when you're calling it from servicenow um so you can load.net libraries into Powershell into the Powershell runtime you can create your mid-server script file which will load up those libraries and then use those libraries from Powershell and return the results so for all intents and purposes you can execute any code you really want because that that gives you the two compiled languages that are a big deal when it comes to node.js or anything else you can execute command line uh commands as well from the midserver so you can call the node node.js command line tool or any other command line tool that you might need to as long as it's available on the mid server that you've got configured all right last thing that that I'm I was playing around with uh like I said back in the day everything went through the eccq um and technically everything gets started from the eccq still um and all of the old functionality is still there but there is one type here that you might have seen the iPass action probe um if I open this up let me open up one of these outputs there's not a whole lot of information here and definitely not much that you can decipher um which was driving me nuts so you've got some engine config remove Ops some information about the user the reporting whether or not it's going to run in the foreground or whatnot but that's about it there's no other information so this is all when I execute um when I executed my my rest message when I executed my mid-server script when I executed my um Powershell from flow designer this is all you're going to see in the UCC queue which is it's nice because it's servicenow made it more robust but it's also a lot more difficult to debug because you're not going to see your errors here anymore which is kind of frustrating to me um so one of the things I did was I wanted to know okay what the heck is happening what's going on where can I look in the instance and I'm still drilling into some of this information but where can I look in the instance that's actually going to tell me what's getting passed in for back and forth and what's happening so there there's lots of options out there I'm just using this one this is called MIT M proxy this is a proxy that I've just got running right on my desktop here the mid server the test proxy mid server that you saw is also running on my desktop and I'm running the mid server through this proxy and so that way I can see everything that's happening uh between servicenow and the mid-server and so once I did this it kind of showed me a little bit more um and I waited on normally I used to start with this but I waited to to tell talk about um exactly what servicenow is using for a connection until we showed I showed this so uh originally out of box service down mid server would pull servicenow just do a soap request every five minutes for work to do it would check that eccq every five minutes which had a you know it's got a pretty good lag time real time uh work being done on the mid server wasn't too great or anything like that servicenow decrease that and decrease that and decrease that we used to run it at a minute but there's only so much you can do when when doing a soap request over and over again so then they moved to the bayox comet d uh protocol what that's doing is it's using servicenow's amb or asynchronous message bus so like I said this this is why I said this is a deep dive because I'm this is stuff that you don't really need to know um it's I just find it very interesting and it lets me know uh some of the things that I can look at um all right any better now awesome thank you sorry about that uh my my headset died um I'm in summer in Wisconsin and I've got an air conditioner that's sitting next to me so I'm not using my normal mic that I use usually do and I think my old headset uh battery doesn't last nearly as long okay so I'll go back a little bit um so servicenow uses um with its change over the past number of years it's using that bay ux Comet D protocol and so it's doing long polling as you can can see on on the uh the screen here long polling long polling just says hey I'm gonna open up an HTTP request and then when you have something for me to respond uh or have something to send me you can respond and so it's basically just an open connection and then eventually it'll time out and then it'll make another one um that's what long polling is in a nutshell um but the big thing about that is now it's near real time and so as soon as something gets added to that ECC queue it's going to get pushed out to the mid server or pulled from pulled by the mid server I should say by the way I do say sometimes pushed out technically nothing is ever pushed from the instance it's always pulled from pulled by the mid server um so don't I hope that doesn't confuse anyone um but the proxy here is showing us what what happens and if I scroll up um well here I'm gonna I'm gonna just execute one right now just to go a little faster um that so we can see a bunch of stuff is happening right now all right so the first thing it did was it connected and it said all right keep alive Channel yada yada um here we go it got results so this is a one of the record sets so this is the eccq record so I've Got My ECC key record in here now iPass action probe and it's got a source um and so then once it it it still uses the eccq to let the mid server know it has stuff to do but then you see this here Hub lock Hub plan Hub integration Hub plan this is where it's actually getting information about what it needs to do so this is one of the responses and there's some additional details in here but you can see here the name is mid-server execute script I think that's what I named mine midserver execute script and then some other information name error eval so basically what servicenow did was they changed how it communicates a little bit where the ccq starts it off but then the mid server will actually go back and take a look at things that it needs to do um I'm I'm still working on some additional error handling and logging for this to make debugging a little bit easier obviously the debugging isn't bad um because when you when you're inside of flow designer and you run your test it gives you a really nice breakdown but the one thing that it doesn't give you is necessarily the output unless you've specifically asked for it um in in your code so like if I didn't log the outputs here because I have no output variables uh mapped on mine here I don't necessarily see what the actual output was of uh the mid server so I can see a lot of the information down here Divine connection this is the actual script that was run um and the output data but because of the fact that I don't have it mapped I don't even get to see it and uh without having the proxy set up I no longer even can see what's being run on the mid server so there's there's a few things there like I said I'm I'm in the process of doing some additional work um to make that a little bit easier so we can see a little bit more uh information on what's going on there but just keep that in mind but these the the debugging here within flow designer is exceptionally helpful um especially you know just make sure that you're mapping some of those outputs you might have to add some additional logging and then the final thing you can do with that though is if you go to your mid server after you've run those like I was using ms.log which is just like our our Glide system gs.log but except it's on the mid server I can then come in here and I can grab the mid server logs and it that should be in those mid-server logs so you know it's a trade-off um I I think it's a decent trade-off because uh flow designer is far easier um let's see here I didn't I think I turned on okay uh well I was just pulling up q a I don't know if anyone has any questions um I always you know I wanted to give a couple of minutes here in case anyone has uh any questions right now um I I do have the Q a turned on but you can use the chat if you want to as well um I'm taking a look on there now if I don't get any questions in a couple of in a minute or so I will uh go ahead and adjourn us a little bit here but um as I said coming out of this uh even just talking to you about some of this stuff I'm going to do an in-depth webinar either webinar or or video on running.net through Powershell on the midserver um if you have any questions or any uh you know want to know any more about this feel free to contact me um either through Linkedin or by any other means that you might have I'm sure there's some contact information on the event I don't see any questions coming in right now so oh okay um oh actually uh thank you Brian so um maintaining mid servers there's there's been a lot of changes over time and I I will fully admit I haven't fully adopted all of them um servicenow is really trying to move to Docker to um for all the mid servers so they offer Docker containers and the instructions on creating Docker containers um I love Docker in general but I've had some issues with upgrading mid servers that are in Docker um which I mean I guess in theory the idea is that you don't have to um you know you can bring down one container and then just bring up another one uh with the newer version and whatnot but uh I haven't fully adopted that yet so I still run things in the old way but ultimately um the nice thing is mid-servers Will Auto upgrade uh by default you can pin them um and so if you want them to stay on a single version uh you can pin them but you will get an error on the instance if your instance gets upgraded and you have it pinned and you don't upgrade your mid server and eventually you could get some errors um that actually occur where the midterm mid server stops functioning completely so for the most part I usually leave it on auto upgrade unless there's something else that that uh some other reason um but also it's part of an upgrade plan for any any upgrade uh let's see I did want to touch on security actually because I mentioned it earlier um what came up the other day was a servicenow and this is I think it was before my time even uh there's an attachment generator that so in in service in the eccu I don't know why they used this particular table but uh if you opened up the eccq to a web to use one of the web services because every table in servicenow by default gets web services associated with it it's just automatic every table gets web services now that can be locked down but every table has um you can go to question mark wsdl to get the wisdle for it you can go um you can look at the the rest API for it all of that but servicenow made um a a sensor or a processor where I could push data to the eccu um or push an attachment that's basic 64 encoded and then it would create that attachment um real real you know it was real Handy functionality back in the day but now when I think about that it makes me shutter because um everything we've talked about the UCC queue is the entry point to your infrastructure and so when we're talking about mid-server security number one zero trust is is the way to go these days um making sure that every connection from your mid server is trusted and has uh the kind of the right um the authorization that it needs and only the authorization that it needs and paths that the only the paths that it needs because if someone was able to directly insert something into your eccu we've just seen I can run system commands I can run Powershell depending on what you have the if it's a Windows server and you're running it as a by default you're not allowed to but you can go back in and change it if you're running the service that the mid server is running as as an administrator um you're you're opening up your infrastructure to whatever that mid server wants to do and and so then if we opened up that eccu somebody could easily gain access and and be a a malicious have malicious intent um and so security is Key by default on a box almost all almost all that stuff is turned off and so you don't really have to worry about it um too much it's just a check to make sure when a new instance is spun up but um these are just things that whenever I see them being said to turn them on it it makes me shudder um let's see best practices uh the other thing that I always suggest the nice thing is you can spin up multiple mid servers on one device and so make each mid-server application fairly uh specific um you know it's six of one half dozen in another But ultimately to me I'd rather have two mint servers one for for um you know for Discovery if I'm running full Discovery or or six or seven if I'm running full Discovery and then another one for SCCM that way the one for SCCM I can worry about you know what it needs to connect to and then the discovery one can be very specific around the discovery that I'm going to allow for my infrastructure um let's see and then and I I'm hoping servicenow gets a little bit better at this down the road but maintenance of the mid-server virtual machine um is something else that that's kind of key you want to make sure any vulnerability abilities get patched and all of that so make sure the the mid server virtual machine um needs to be monitored just like any other device on the network um but because of the fact that it has uh a high potential I would I would probably put it in my high priority not necessarily high risk but high priority um list for for monitoring for vulnerabilities all right well thank you all for joining today um I will be following up if anyone has any other questions that didn't get asked today please reach out um thanks again and I hope everyone has a great Friday and a great weekend take care but
https://www.youtube.com/watch?v=0ldGpEAxqGA