使用az apim update命令修改APIM自定义属性失败的问题求助
Problem
When I checked my Azure API Management instance details using:
az apim show -n Namexxx -g RGxxx
The output included this in 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" }
But when I tried to update the TripleDes168 property with this command:
az apim update -n xxNamexx -g xxRGxx --set customProperties.Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168=false
I got the error:
Couldn't find 'Microsoft' in 'customProperties.Microsoft.WindowsAzure.ApiManagement.Gateway.Security'. Available options: ['Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2']
Root Cause
The issue comes down to how the Azure CLI parses nested property paths. Since the custom property keys themselves contain dots (.), using dot notation directly splits the key into unintended hierarchy levels. The CLI tries to look for a sub-property named Microsoft under customProperties.Microsoft.WindowsAzure.ApiManagement.Gateway.Security, which doesn't exist—leading to the error.
Solution
You need to treat the full property key as a single string by wrapping it in quotes. Use either of these two valid syntaxes:
Option 1: Bracket notation (recommended)
az apim update -n xxNamexx -g xxRGxx --set "customProperties['Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168']=false"
Option 2: Quoted key with dot notation
az apim update -n xxNamexx -g xxRGxx --set customProperties."Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168"=false
Verify the Change
After running the update command, recheck your APIM instance details with az apim show -n Namexxx -g RGxxx to confirm the TripleDes168 property is now set to false.
内容的提问来源于stack exchange,提问作者tester81

