简体   繁体   中英

AzureRM commands in Azure powershell Task: Azure DevOps

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?

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: 在此处输入图片说明

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM