Skip to content

Automating MDM Renewals Using Jamf and Okta Workflows

Hi,

We have some computers that are in Jamf. Sometimes Jamf doesn’t like to play nice and renew the MDM on the device. To start you’re going to need an Advanced Computer Search in Jamf. The fortunately have a criterion called “MDM Profile Expiration Date” and we set that to less than 11 days.

Alright, you got that? Great! Next you need to get the ID for that Advanced Computer Search. You can find that in the URL

https://YOURJAMFINSTANCE/advancedComputerSearches.html?id=888&o=r

In the example above, it’s 888.

In Okta Workflows, create a new flow, give it a name and tell it that it’s a Scheduled Flow. I’m not explaining every little thing. Here’s Okta’s documentation. We run ours once a week.

Let’s go through each card.

Concatenate

This is just so I have an obvious place to change the id for the Advanced Computer Search. The Classic API will ask for the Relative URL, which needs to be JSSResource/advancedcomputersearches/id/<idnumber>. So I like having that in a separate card so I can see it easily.

Custom API Action (Jamf Pro Classic API)

This one is simple, you just grab the output from the previous card and drag that into the Relative URL. The rest is all handled by the existing connection. It gives you a list of all computers

Parse

Parse will take the previous list and get only the computers, no the superfluous data passed from Jamf.

Get

Now you want to get specific data. So you have to take the output from Parse and pull out advanced_computer_search.computers

For Each

Then for each item in the list, you need to run a helper flow.

Helper Flow

The helper flow is going to get some data from Jamf, the id, udid, and name. Then we need to store those in variables.

Get x 3

We’re going to grab that “Computers” object and pull out each of those items and store them in a variable called device<path>.

ConCATenate

Here we need text that’s different from what we got. So we’re using concatenate cards to combine strings with other strings. In this instance, we’re formatting the UDID so it has the wrapping JSON to send back to Jamf. We’re also using the other two variables to write a human readable message to save as slackMessage. Meow.

Generate Bearer Token & Custom API Action (Jamf Pro API)

So you’ll see we’re using the Jamf Pro API this time rather than the Classic. This command only exists in Jamf Pro API. As such, we need to get a Bearer token, The Body is the first output from the first Concatenate card immediately above. The relative URL is the API endpoint you want, in this case /v1/mdm/renew-profile.

Send Message To Channel

Finally we want to notify the Endpoint Team that this has been done, as such, we send a message to a channel with this card.

Tags:

Leave a Reply