Just explicitly select the option to use Powershell core (v 7.0.3) in Azure DevOps. PowerShell Core runs side-by-side with Windows PowerShell. By default, when you are using the Powershell task on Azure DevOps, it uses normal PowerShell.
You can also enable Powershell core on Azure DevOps task by a checkbox in Powershell Core under Advanced settings.