How to get TFS changesets including workitem details using PowerShell?

Visual Studio Online provides a convenient way to access the data and combine it to provide the users with useful information. This is done via a set of REST APIs for Visual Studio Online.

Although, there are several out-of-the-box queries available which can be used to gather information but there are cases when you want to take it to next level to suit your own needs.

Note that these APIs are also available to on premise Team Foundation Server

This post demonstrates an example of accessing REST API using PowerShell to get the details of all change-sets in a particular project collection.
Further, this change-set data is enhanced with information about the WorkItems linked to the change-sets.