Azure Autimation - Powershell script failing

Nibbler 656 Reputation points
2021-03-31T05:14:07.11+00:00

Hi all,

I have the following PS script, that I want schedule using Azure Automation, is failing saying that "Set-AzureRmAppServicePlan" is not correct. That I dont understand as it works geat when running it in Azure Cloud Shell

Set-AzureRmAppServicePlan -Name "Solution-EUWE" -ResourceGroupName "Shared" -Tier PremiumV2 -NumberofWorkers 1 -WorkerSize "Small"

The error:
Set-AzureRmAppServicePlan : The term 'Set-AzureRmAppServicePlan' 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. At line:1 char:1 + Set-AzureRmAppServicePlan -Name "Solution-EUWE" -ResourceGroupName " ... + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Set-AzureRmAppServicePlan:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

Azure Automation
Azure Automation
An Azure service that is used to automate, configure, and install updates across hybrid environments.
1,366 questions
Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 123.4K Reputation points MVP Volunteer Moderator
    2021-03-31T08:34:04.093+00:00

    Hi @KE1980 ,

    the cmdlet Set-AzureRmAppServicePlan is part of the AzureRM.Websites module.
    This module is not imported in an Azure Automation Account by default.

    Please try the following steps:

    In the Azure Portal ...

    83235-image.png

    Import the module ...

    83216-image.png

    Now the runbook should work.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.