Azure API 管理 - 如何使用 Azure Cli 添加 API 和操作?

Azure API Management - How to add an API and Operation using Azure Cli?

我已经手动添加了下面的 API 和 Operation on Azure API Management

我已尝试使用 azure cli 添加相同的 API & 操作,但无法成功。如何使用 Azure Cli 或 Azure Powershell 在 Azure API 管理上添加 API 和简单操作?

您可以使用 Azure CLI:

请在我的博客中找到更多详细信息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