This is not a VSCode specific issue, it is a OS one. There are different levels for machine, user, process that allow PowerShell Scripts to run and it must be enabled.
If this is your machine just change the execution policy to RemoteSigned or unrestricted so that is applies to your entire system. If you just want to use it in VSCode, the change your settings file or change you shortcut to include the execution policy you want to use. The Recommendation is RemoteSigned. Meaning all local code will run, but any remote scripts must be signed.
If this is a corporate machine, that has the Execution set to Restricted, then no code will run until that setting is changed. You can still run code by selecting it all in the VSCode editor and hitting F8. Now, if they have enforced this policy, then you need to talk to the IT time to get them to change it for you.
All of this is detailed in the PowerShell Help files.
Get-Command -Name '*executionpolicy*' | ft -AutoSize
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Get-ExecutionPolicy 3.0.0.0 Microsoft.PowerShell.Security
Cmdlet Set-ExecutionPolicy 3.0.0.0 Microsoft.PowerShell.Security
# get function / cmdlet details
(Get-Command -Name Get-ExecutionPolicy).Parameters
Get-help -Name Get-ExecutionPolicy -Full
Get-help -Name Get-ExecutionPolicy -Online
Get-help -Name Get-ExecutionPolicy -Examples
Get-ExecutionPolicy
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Get-ExecutionPolicy -List
(Get-Command -Name Set-ExecutionPolicy).Parameters
Set-help -Name Set-ExecutionPolicy -Full
Set-help -Name Set-ExecutionPolicy -Online
Set-help -Name Set-ExecutionPolicy -Examples
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Set-ExecutionPolicy -ExecutionPolicy Restricted
Invoke-Command -ComputerName "Server01" -ScriptBlock {Get-ExecutionPolicy} | Set-ExecutionPolicy -Force
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy AllSigned -Force
Get-ExecutionPolicy -List
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Undefined
Set-ExecutionPolicy -Scope Process -ExecutionPolicy AllSigned
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
Note, if your org is controlling this, the again, talk to them before trying to bypass the policy, because if they did this, this also means they are monitoring it, and if you do this that will know. I have seen things like this engender RPE's. (Resume Producing Events)