I have prepared a release pipeline in Azure Devops. The pipeline has a powershell task. This is the inline code.
Install-Module -Name Az -AllowClobber -Force
Install-Module -Name Bicep -Force
Import-Module Az.Accounts -Force
$PSVersionTable
This is the log output:
"C:\Program Files\PowerShell\7\pwsh.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a_temp\67e051fe-1dd4-4420-b9c0-577a882c1207.ps1'"
[33;1mWARNING: Both Az and AzureRM modules were detected on this machine. Az and AzureRM modules cannot be imported in the same session or used in the same script or runbook. If you are running PowerShell in an environment you control you can use the 'Uninstall-AzureRm' cmdlet to remove all AzureRm modules from your machine. If you are running in Azure Automation, take care that none of your runbooks import both Az and AzureRM modules. More information can be found here: https://aka.ms/azps-migration-guide[0m
[32;1mAccount SubscriptionName TenantId Environment[0m [32;1m-------
---------------- -------- -----------[0m *** xxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx AzureCloud [32;1mName : [0mxxxxxx (xxxxxxxxxxxxxxxxxxxx) - xxxxxxxxxxxxxxxxxxxx - [32;1m[0m*** [32;1mAccount : [0m*** [32;1mEnvironment : [0mAzureCloud [32;1mSubscription : [0mxxxxxxxxxxxxxxxxxxxxxx [32;1mTenant : [0mxxxxxxxxxxxxxxxxxxxxxx [32;1mTokenCache : [0m [32;1mVersionProfile : [0m [32;1mExtendedProperties : [0m{}
Two questions:
- what's wrong with characters?
- what does it means this "Both Az and AzureRM modules were detected on this machine" and hot to fix it?
I searched for something but i'm confused and not able to distinguish between various things I have found.
Thanks in advance for helping me.
CodePudding user response:
This is due to the newer versions of pwsh using ANSI to colour code the terminal.
You can disable it as part of your pipeline task too
More here: