I get this message when I run Connect-AzAccount in PowerShell ISE, try running your script with the PowerShell command line tool.