Hello!

I don't recall when it was, but recently Microsoft released a new version of the the Azure PowerShell module. This is to work with PowerShell Core, and htey chose to call it Az, which was already a name used by Microsoft as short-hand for the az cli. Irrespective of this muddying the waters, AzureRM is no longer being worked on. So new scripts should be developed using Az instead of AzureRM. So there I was writing some scripts the other day using Az, and they worked locally no issue. Push them to the repo, have them run as an Azure PowerShell task and whoops! They fail. Looks like Az is not installed on the agents.

The term 'Test-AzDataLakeStoreItem' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Now this is the hosted agents, so the choice of adding them myself is not possible. Took me a little while to figure out why this was happening, but it all comes down to the version of the task you are using.

buildtask

Version 4 and above will run on agents that have Az installed. Lower versions will use AzureRM.

aztaskversion4

This is because they cannot be installed side by side, but you can enable aliases when using Az to replicate the names of the AzureRM cmdlets. By reading the hints you can see this in the context of the tasks.

aztaskversion3ps

Above is the versions accepted for version 3 of the Azure PowerShell task. And below this is the Az versions supported by version 4 of the task.

aztaskversion4ps

So yes amazingly reading the tooltips actually helped.