Azure API 调用 - az apim 更新 - 更新 customProperties

问题描述 投票:0回答:1

我正在使用以下 az api 调用命令

az apim show -n Namexxx -g RGxxx
。作为输出,我得到以下结果:

{
"additionalLocations": null,
"apiVersionConstraint": {
"minApiVersion": null
},
"certificates": null,
"createdAtUtc": "2021-10-15T08:49:38.486813+00:00",
"customProperties": {
"Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2": "false",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30": "false",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10": "false",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11": "false",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168": "true",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30": "false",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10": "false",
"Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11": "false"
},

我需要修改其中一个

customProperties
。我尝试使用命令:
az apim update -n xxNamexx -g xxRGxx --set customProperties.Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168=false
但我收到如下错误:

Couldn't find 'Microsoft' in 'customProperties.Microsoft.WindowsAzure.ApiManagement.Gateway.Security'. Available options: ['Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2'

在 MS API dos 中没有找到任何有用的信息 --> AZ apim API

azure azure-devops azure-api-management azure-cli
1个回答
1
投票

@tester81

命令组“apim”处于实验阶段并正在开发中。我最后测试了该功能,并且在 WinPowershell 中遇到了相同的问题。

我确实在 Ubuntu 终端发现了不同的行为。

如果您不使用 Win Powershell/cmd 来调用 az commandlet,您可以在 Linux 终端中尝试以下脚本。

customPropertiesUpdated=$(az apim show -n <APIM NAME> -g <APIM RESOURCE GROUP> --query customProperties | jq '."Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168" = "True"')
az apim update -n <APIM NAME> -g <APIM RESOURCE GROUP> --set customProperties="$customPropertiesUpdated"

上面的脚本有助于改变状态。但是,Win Powershell / Command Prompt / Cloud shell 中的相关脚本却没有。

替代方案或推荐方法是使用 REST API - 直到它脱离实验阶段。

请参阅

properties.customProperties
- Api 管理服务 - 创建或更新 - REST API(Azure API 管理)|微软文档

© www.soinside.com 2019 - 2024. All rights reserved.