术语 'New-AzureRmApiManagementContext' 未被识别

The term 'New-AzureRmApiManagementContext' is not recognized

我正在尝试通过脚本创建 Azure API 管理的上下文。我拥有的脚本能够在 Azure 门户中执行内置的 powershell 终端。但我正在尝试 运行 通过我的管道编写脚本。 ubuntu 下的电流管道 运行s,这里是 yaml 任务。我试过启用内核和不启用内核。

steps:
- task: AzurePowerShell@5
  displayName: 'Azure PowerShell script: InlineScript'
  inputs:
    azureSubscription: '<sc>'
    ScriptType: InlineScript
    Inline: |
     Set-AzContext -SubscriptionId $(subId)
     $apimContext = New-AzureRmApiManagementContext -ResourceGroupName "$(rgName)" -ServiceName "$(serviceName)"

管道抛出标准错误 -

The term 'New-AzureRmApiManagementContext' is not recognized
     | as a name of a cmdlet, function, script file, or executable
     | program. Check the spelling of the name, or if a path was
     | included, verify that the path is correct and try again.

我在 运行 执行此操作时需要导入什么吗?

解决方法,我可以看到 powershell 上发生了迁移 https://docs.microsoft.com/en-us/powershell/azure/migrate-from-azurerm-to-az?view=azps-6.5.0.

因此,如果我在管道中将其从 New-AzureRmApiManagementContext 更改为 New-AzApiManagementContext,它会起作用。