Skip to content

Initializing Az module failed in Azure DevOps

  • by

Sometimes you may get an error message saying “Az module failed” with the error message a shown below. This is mainly due to issues with Azure CLI in the azure hosted agents or in self hosted agents

The term ‘Clear-AzConfig’ 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.

The issue is mainly due to an issue with AzurePowerShell pipeline task. The problem is only with Azure Powershell task versions 4 and 5 and mitigation step has been applied to solve the issue.