0
votes

I have manually added the below API and Operation on Azure API Management

enter image description here

enter image description here

I have tried azure cli to add the same API & Operations however couldn't make it. How to I add an API and a simple operation on Azure API Management using Azure Cli or Azure Powershell?

1
Do you get an exception? Why is it not working?Markus Meyer

1 Answers

0
votes

You can use Azure CLI:

Please find more details in my blog post:
Create Azure API Management API Operation with Azure CLI

    $resourceGroupName = "eval.datatransformation"
    $serviceName = "mm-sample"
    $apiId="lorem-ipsum"
    $apiDisplayName="Lorem Ipsum"
    $apiId="Lorem"
    $apiPath="/lorem-ipsum"
    $operationPath="/"
    $operationDisplayName="Get"
    $operationDescription="Gets the data"

    az login

    # create the API
    az apim api create --service-name $serviceName  -g $resourceGroupName --api-id $apiId --path $apiPath --display-name $apiDisplayName

    # create the Operation
    az apim api operation create --service-name $serviceName  -g $resourceGroupName --api-id $apiId --url-template $operationPath --method "GET" --display-name $operationDisplayName --description $operationDescription