Need a powershell script to automatically Add a new Azure subscription to a management group based on the offer of MSDN

Hi, whenever a new Azure subscription is added to my organization, It will be by default added to a management group named “TENANT ROOT GROUP”.

I need a PowerShell script that will do the following

  1. If a subscription has an offer equal to MSDN, then it must be moved to a management group named “MSDN” with id = “MSDN”.
  2. If the subscription has different offer than MSDN, then it must be moved to a management group named “Not Managed subscriptions” with id = 0x0x0x0-e401-xxxx-be84-cxsxsc95deb9f"

Can some one plz help me out on this… I am not familiar with Powershell.