1
votes

I am attempting to run an azureRM script via a devops pipeline.

I have tried all the possible powershell tasks, however I am always met with the following error:

New-AzureRmResource : The term 'New-AzureRmResource' is not recognized as a name of a cmdlet, function, script file, or executable program.

The script is designed to add a VNET to an app service. I am aware that AzureRM is outdated, however there is no way to do cross-regional VNet integration via Az or the az cli.

How can I run an AzureRm script via a devops pipeline?

2

2 Answers

2
votes

I assume you use Microsoft Hosted Agents

Multiple ways:

  1. Invoke-RestMethod - All commands are accessible as API endpoints.
  2. Install-Module - Just Install AzureRM.
  3. Use AzurePowerShell@3 task version - Easiest solution - See docs, The newer @4 and @5 versions do not support AzureRM.
2
votes

Because Az PowerShell modules now have all the capabilities of AzureRM PowerShell modules and more, we'll retire AzureRM PowerShell modules on 29 February 2024. So you can try to use Az.Resources module instead.

For the changes between AzureRm and Az, please view this document(Az.Resources (previously AzureRM.Resources)).

In addition, agree with Repcak. You can use AzurePowerShell@3 task or earlier, because these versions of task support AzureRm modules.

enter image description here