【问题标题】:Get a list of API products via Azure RM powershell通过 Azure RM powershell 获取 API 产品列表
【发布时间】:2019-10-22 07:40:59
【问题描述】:

有没有办法通过 Azure RM powershell 模块获取 API 产品列表?

在 Az powershell 模块中,可以通过将 -ApiId 传递给命令 Get-AzApiManagementProduct 来完成。

【问题讨论】:

  • 使用Get-AzureRmApiManagementProduct获取api产品列表。
  • 现在有更新吗?如果对您有帮助,请接受它作为答案。(单击答案旁边的复选标记将其从灰色切换为已填充。)

标签: powershell azure-powershell azure-api-management azure-rm


【解决方案1】:

您可以使用Get-AzureRmApiManagementProductNew-AzureRmApiManagementContext 来获取api 产品列表。

$ApiMgmtContext = New-AzureRmApiManagementContext -ResourceGroupName "yourresourcegroup" -ServiceName "yourapimname"
Get-AzureRmApiManagementProduct -Context $ApiMgmtContext -ApiId $apiname

【讨论】:

  • 但它会返回所有产品,当我需要获取仅添加了那些产品特定 API 的列表时。有一种方法可以使用 Az 模块(Get-AzApiManagementProduct 具有 ApiId 参数,我可以在其中指定必要的 API),但是有没有办法在 Azure RM 模块的帮助下获取此信息。
  • 是的,你可以使用Get-AzureRmApiManagementProduct -Context $apimContext -ApiId $apiname来实现它。
  • 我已经更新了我的回复,如果对你有帮助,请采纳。谢谢。
  • 当我尝试使用 -ApiId 运行此命令时,返回此类错误:“Get-AzureRmApiManagementProduct:找不到与参数名称“ApiId”匹配的参数。”代码类似于:code $apimContext = New-AzureRmApiManagementContext -ResourceGroupName $rgName -ServiceName $apimName Get-AzureRmApiManagementProduct -Context $apimContext -ApiId $apiId code --- AzureRM 版本 = 6.13.1 AzureRM.ApiManagement 版本 = 6.1 .7 是否有某些原因导致此 ApiId 参数在某些情况下不可用(例如对我而言)?
  • 实际上,AzureRm 模块将被弃用并且永远不会更新。我成功的原因是我在这个链接中使用了Try it。这将自动 Enable-AzureRmAlias 为 Az 模块启用 AzureRm 前缀别名。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-11-26
  • 2018-07-20
  • 1970-01-01
  • 2021-01-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多