lucuma
lucuma

Reputation: 18339

Azure Automation: The term 'Set-AzureRmAppServicePlan' is not recognized

I am trying to scale up a service plan using Set-AzureRmAppServicePlan. I'm connecting fine, can list all the resources in the account but when calling the app plan method, it isn't found. What is being missed here?

Code:

$connectionName = "AzureRunAsConnection"
try
{
    # Get the connection "AzureRunAsConnection "
    $servicePrincipalConnection=Get-AutomationConnection -Name $connectionName         

    "Logging in to Azure..."
    Add-AzureRmAccount `
        -ServicePrincipal `
        -TenantId $servicePrincipalConnection.TenantId `
        -ApplicationId $servicePrincipalConnection.ApplicationId `
        -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint 
}
catch {
    if (!$servicePrincipalConnection)
    {
        $ErrorMessage = "Connection $connectionName not found."
        throw $ErrorMessage
    } else{
        Write-Error -Message $_.Exception
        throw $_.Exception
    }
}

Select-AzureRmSubscription -SubscriptionId "MYSUB"

Set-AzureRmAppServicePlan -Name "my-plan" -ResourceGroupName "my-group" -Tier "Standard" -WorkerSize "Small"

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:35 char:1
+ Set-AzureRmAppServicePlan -Name "JJJLK" -ResourceGroupN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Set-AzureRmAppServicePlan:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Upvotes: 4

Views: 2194

Answers (1)

Shui shengbao
Shui shengbao

Reputation: 19195

You need import the appropriate modules into your Azure Automation Account. You could import modules from Automation Module Gallery with the Azure Portal.

enter image description here

More information please refer to this article.

Also you could import the module by the link.

enter image description here

Wait for a moment, you could find the two cmdlet in Portal.

enter image description here

Upvotes: 6

Related Questions