如何解决在APIM中使用Powershell命令删除操作
我想使用Az Powershell命令从apim中删除操作。有人知道吗? 我正在查看Remove-AzApiManagementOperation的文档 这是给出的示例:
Remove-AzApiManagementOperation -Context $apimContext -ApiId "0123456789" -OperationId "9876543210" -Force
我试图使用以下代码来获取operationID,但它始终会出错:
Get-AzApiManagementOperation -Context $apimContext -ApiId $APIId -OperationId "Operation003"
这里的操作名称是“ Operation003”吗?我如何找到给我的手术起的名字。 我所看到的只是我的Api ...这是“ MyTestService”,而我的操作是“ CreateCustomer”
有人成功吗?任何信息表示赞赏。 谢谢
更新:我尝试过
$ AllOperations = Get-AzApiManagementOperation -Context $ ApiMgmtContext -ApiId $ ExistingAzureApi.ApiId 写入主机$ AllOperations
在输出中,我看到的只是 Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOperation
如何在PS中获取此对象的属性? $ AllOperations.OperationCollection [0] .Name ????
解决方法
弄明白了..很奇怪,但这就是它
$CustomerCreate = Get-AzApiManagementOperation -Context $ApiMgmtContext -ApiId $ExistingAzureApi.ApiId | Where-Object { $_.Name -eq 'CreateCustomer' }
所以现在我们有了一个指向要删除的操作的对象。 我们现在可以调用删除
Remove-AzApiManagementOperation -Context $ApiMgmtContext -ApiId $ExistingAzureApi.ApiId -OperationId $CustomerCreate.OperationId
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。