问题描述
我已经手动添加了以下API和Azure API管理上的操作
我尝试过azure cli添加相同的API和操作,但是无法实现。如何使用Azure Cli或Azure Powershell在Azure API管理上添加API和简单的操作?
解决方法
您可以使用Azure CLI:
请在我的博客文章中找到更多详细信息:
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