0
votes

I want to use Az Powershell command to remove operation from apim. Does anyone know how? I am looking at documentation for Remove-AzApiManagementOperation This is the example given:

Remove-AzApiManagementOperation -Context $apimContext -ApiId "0123456789" -OperationId "9876543210" -Force

I tried to use the following code to get the operationID but it keeps erroring:

Get-AzApiManagementOperation -Context $apimContext -ApiId $APIId -OperationId "Operation003"

Is "Operation003" the name of the operation here? How can I find what is the name given to my operation. All I see is my Api ...which is "MyTestService" and my operation which is "CreateCustomer"

Has anyone had any success? Any info is appreciated. Thanks

Update: I tried this

$AllOperations = Get-AzApiManagementOperation -Context $ApiMgmtContext -ApiId $ExistingAzureApi.ApiId Write-Host $AllOperations

in output all I see is Microsoft.Azure.Commands.ApiManagement.ServiceManagement.Models.PsApiManagementOperation

How can I get the properties of this object in PS? $AllOperations.OperationCollection[0].Name ????

1

1 Answers

0
votes

figured it out..very weird but it is what it is

 $CustomerCreate = Get-AzApiManagementOperation -Context $ApiMgmtContext -ApiId $ExistingAzureApi.ApiId  | Where-Object { $_.Name -eq 'CreateCustomer' }

so now we have an object that points to the operation to be deleted. we can now call Remove

 Remove-AzApiManagementOperation -Context $ApiMgmtContext -ApiId $ExistingAzureApi.ApiId -OperationId $CustomerCreate.OperationId