Cover Image by Kurtis Beaver @ dribbble.com/shots/7174817-Microsoft-Learn
I’ve just received an email from Microsoft that there is an ongoing Cloud Skill Challenge for Singapore this morning. As a beginner in Azure Platform, I think this is a good initiative to incentivize myself to learn more through the Microsoft Learn platforms.
The rules are pretty simple, Top 3 winners will walk away with Surface Go 2. A decent prize I would say. Winners are decided by the total XP (experience points) gained over the duration of the challenge.
It is about 2 weeks into the challenge. I quickly signed up and went to see how is the top learner doing. To my horror, the top 2 learners are sitting at over 3,000,000 XP.
For those unfamiliar with Microsoft Learn, you can get about 100XP to 300XP for completing a unit of learning. Each unit would take 5 minutes to 30 minutes, depending on the complexity of the unit itself. My arithmetic sense told me something fishy is going on.
After a few minutes of searching, I found out that Microsoft does expose their catalogue API at https://docs.microsoft.com/en-us/learn/support/catalog-api
The response from the above API gives us complete information of all learning paths and modules that exists on Microsoft Learn.
By tinkering with the developer console of my browser, I found out the API required needed to do the job. Before going into the gist of this exploration, let us review some terminology on Microsoft Learn.
Unit: Smallest unit in Microsoft Learn. You gain XP for completing each unit.
Module: A module comprises multiple units. You unlock an achievement for completing each module.
Learning Path: A learning path comprises multiple modules. You gain a trophy for completing each learning path.
The endpoint to complete a unit is (via PUT request) https://docs.microsoft.com/api/progress/units/${Unit}. This endpoint requires Bearer Token, which is easily extracted via developer console or via Microsoft Graph API.
To get the unit name, we would need to extract information of all unit from either the module or learning path.
I found out that the following endpoint returns the following information:
https://docs.microsoft.com/api/hierarchy/paths/${LearningPath}
Combining the three API and some JSON wrangling, the rest is to call the complete API with some delay to avoid getting rate-limited by the server.
Some units could not be completed due to the existence of the “Knowledge Check” section. This requires the PUT request to include the answer to those question.
The entire process took no more than 30 minutes, just think about it. While I appreciate Microsoft for putting in the effort to advocate a culture of learning, there is much to be done on the Cloud Skill Challenge.
As an afterthought, exposing your entire API to the public requires much consideration as it might lead to unforeseen usage such as this exercise.
I’ve pushed the code with detailed instruction of this exercise to Github.
PS: There is more than 19,000 unit of learning available on Microsoft Learn (For FREE!), it is indeed a great resource for self-paced learning.
Disclaimer: Try this at your own risk, most likely we’re violating the T&C of the platform & the challenge.