简体   繁体   English

在 APIM 中添加 websocket 操作,根级别为 powershell

[英]Adding a websocket operation in APIM with powershell at root level

I am trying to import a Websocket Api through Az scripts.我正在尝试通过 Az 脚本导入 Websocket Api。

As described in Microsoft doc here , this api contains a method onHandshake at root level.如此处的 Microsoft 文档中所述, api 包含根级别的 onHandshake 方法。

$operationDst = New-AzApiManagementOperation 
   -Context $apimDstContext 
   -ApiId $fullApiId 
   -ApiRevision $api.ApiRevision 
   -Name $operation.Name 
   -OperationId $operation.OperationId 
   -Method $operation.Method 
   -Description $opDescription 
   -UrlTemplate $urlTemplate 
   -Request $requestDst 
   -Responses $responsesDst 
   -Debug -Verbose -ErrorAction Break;

Problem is when importing this method the -urltemplate param value is "" and I keep receiving this error:问题是导入此方法时 -urltemplate 参数值为“”,我一直收到此错误:

System.Management.Automation.ParameterBindingValidationException: Cannot validate argument on parameter 'UrlTemplate'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.

I tried setting it to $null for no better and "/" which then gives me this error:我尝试将它设置为 $null 并没有更好,然后“/”给了我这个错误:

"Operation entity cannot be defined by user for web socket api type."

Actually the onHandshake method is automatically added when creating a Websocket Api. So I should just ignore the import of that method实际上onHandshake方法是在创建Websocket Api时自动添加的。所以我应该忽略那个方法的导入

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM