Azure自动化:术语' Set-AzureRmAppServicePlan'不被承认

时间:2017-01-10 02:55:22

标签: azure azure-powershell azure-automation

我正在尝试使用Set-AzureRmAppServicePlan扩展服务计划。我连接正常,可以列出帐户中的所有资源,但在调用应用计划方法时,找不到。这里错过了什么?

代码:

$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"

错误:

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

1 个答案:

答案 0 :(得分:3)

您需要将相应的模块导入Azure自动化帐户。您可以使用Azure门户从Automation Module Gallery导入模块。

enter image description here

更多信息请参阅此article

您也可以通过link导入模块。

enter image description here

等一下,您可以在Portal中找到两个cmdlet。

enter image description here