@Abhishek Rao To deploy any resources at management group scope, subscription scope or resource group scope, you can take advantage of the "ARM Template deployment" task which is available for Azure Pipelines. In my opinion, this is way easier then using Azure PowerShell Task.

From the snapshots provided, these can be some of the reasons for the errors you are prompted with.
1)Kindly note managed identities are not supported on Microsoft Hosted Agents. You will have to set-up a self hosted agent on an Azure VM and configure managed identity for the virtual machine.
2) If you are using Microsoft Hosted Agents, I would suggest you to create Service connection with Azure Resource Manager using service principle. For more information on service principal, refer this document.
3) If you are using self hosted agents, kindly install all the required Az PowerShell modules on self-hosted agent.
4) Here is a document which lists on troubleshooting Azure Resource Manager service connections which can help you fix the connection issue.
Answering to your questions :
1) Which pipeline task I have to use to run my powershell script.( i.e plain Powershell Task or Azure powerShell Task) - Use Azure PowerShell Task

2) If we can use Azure power shell task, which version we have to use. - In my opinion , always use latest version

