Friday Fact: You Can Manually Fix AzureRM Cmdlet Errors in Logic Apps Deployment by Using Az Module Commands

  • Luis Rigueira
  • Nov 29, 2024
  • 2 min read

If you’re working with Logic Apps in Visual Studio 2019, you may have encountered an issue when deploying Azure resources using the Deploy-AzureResourceGroup.ps1 script.

Deploy-AzureResourceGroup.ps1

This script might be using commands from the now-deprecated AzureRM module, causing errors when running your deployment.

Here’s how to resolve this issue by replacing the outdated AzureRM cmdlets with the newer Az module commands, ensuring your script works seamlessly.

📝 One-Minute Brief

When deploying Azure resources for Logic Apps, you may encounter failures caused by deprecated AzureRM PowerShell cmdlets. In this Friday Fact, I explain how to manually fix AzureRM cmdlet errors in Logic Apps deployments by replacing them with modern Az module commands. This approach allows you to unblock deployments, modernize PowerShell scripts, and align with Microsoft’s current Azure tooling recommendations.

Common Errors You Might Encounter:

sourceGroup.ps1: The term 'Get-AzureRmResourceGroup' is not recognized as the name of a cmdlet, function, script file, or operable program.
CommandNotFoundException, Deploy-AzureResourceGroup.ps1
Deploying template using PowerShell script failed.

Solution:

The AzureRM module has been deprecated, and Microsoft recommends using the Az module instead. Below is a list of cmdlet replacements that should resolve your deployment issues.

AzureRm (Deprecated) Az Module
Get-AzureRmResourceGroup➡️Get-AzResourceGroup
New-AzureRmResourceGroup➡️New-AzResourceGroup
Get-AzureRmStorageAccount➡️Get-AzStorageAccount
New-AzureRmStorageAccount➡️New-AzStorageAccount
New-AzureStorageContainer➡️New-AzStorageContainer
Set-AzureStorageBlobContent➡️Set-AzStorageBlobContent
New-AzureStorageContainerSASToken➡️New-AzStorageContainerSASToken
(Get-AzureRmContext).Subscription.SubscriptionId➡️(Get-AzContext).Subscription.Id
BlobEndPoint➡️BlobEndpoint
New-AzureRmResourceGroupDeployment➡️New-AzResourceGroupDeployment

Install the Az Module: First, make sure you have the Az module installed on your system. You can install it using the following PowerShell command:

Install-Module -Name Az -AllowClobber -Force -Scope CurrentUser

Update the Deploy-AzureResourceGroup.ps1 Script: Open the Deploy-AzureResourceGroup.ps1 file in your project and replace the AzureRM cmdlets with the corresponding Az module cmdlets

After replacing the commands, save the file and try running the script again. Your deployment should now work without encountering the errors related to the AzureRM cmdlets.

To lazy to read? We’ve got you covered! Check out our video version of this content!

Hope you find this helpful! If you enjoyed the content or found it useful and wish to support our efforts to create more, you can contribute towards purchasing a Star Wars Lego for Sandro’s son!

Buy me a coffee
Author: Luis Rigueira

Luis Rigueira is a Enterprise Integration Consultant at DevScope

Leave a Reply

Your email address will not be published. Required fields are marked *

The Ultimate Cloud
Management Platform for Azure

Supercharge your Azure Cost Saving

Learn More
Turbo360 Widget

Back to Top