Recently, it appears that PowerShell reacts in odd ways on MS-hosted agents that have multiple versions of e.g. Az.Accounts & Az.Resources installed.
We may be able to mitigate these issues by removing the Az.Resources dependency whereever we can. In case of, for example, the Image Template cleanupt task, we could even shift the Task from an AzureCLI to an AzurePowerShell task if we get rid of the Search-AzGraph -Query "Resources | where resourceGroup == '$resourcegroupName' | where name startswith '$imageTemplateName'" command in favor of, for example the REST API.
Recently, it appears that PowerShell reacts in odd ways on MS-hosted agents that have multiple versions of e.g. Az.Accounts & Az.Resources installed.
We may be able to mitigate these issues by removing the
Az.Resources
dependency whereever we can. In case of, for example, the Image Template cleanupt task, we could even shift the Task from an AzureCLI to an AzurePowerShell task if we get rid of theSearch-AzGraph -Query "Resources | where resourceGroup == '$resourcegroupName' | where name startswith '$imageTemplateName'"
command in favor of, for example the REST API.