2
votes

I am trying to run a script in the Azure Powershell Task in Azure DevOps that uses AzureRM commands. I tried to use Task version 4.* and 5.*. Both of them are giving error saying that the AzureRM commands couldnt be recognized. (eg. Get-AzureRmResourceGroup is not recognized). What should I do to solve this issue?

1

1 Answers

2
votes

You have there Az Modules available not AzureRM so if you try this

- task: AzurePowerShell@5
  continueOnError: true
  inputs:
    azureSubscription: 'rg-the-code-manual'
    ScriptType: 'InlineScript'
    Inline: 'Get-AzResourceGroup -Name "TheCodeManual"'
    azurePowerShellVersion: LatestVersion

You should get your result.

And if you want you may try to uninstall Az modules and then install AzureRm module. Here you have example how to uninstall az modules.

Here is a simple solution: enter image description here

You may also take a look here to see how to force installation.