使用Azure CLI更新API管理时出错-主机名配置
我正在尝试使用Azure CLI使用新主机名更新我的APIM 这样做的时候使用Azure CLI更新API管理时出错-主机名配置,azure,azure-cli,Azure,Azure Cli,我正在尝试使用Azure CLI使用新主机名更新我的APIM 这样做的时候 $hostConfiguration = '[{ "hostName": "myhostname.com", "type": "Proxy", "keyVaultId": "https://mykeyvault.vault.azure.net/secrets/mysecret"
$hostConfiguration = '[{
"hostName": "myhostname.com",
"type": "Proxy",
"keyVaultId": "https://mykeyvault.vault.azure.net/secrets/mysecret"
}]'
az apim update --name "apim-name" --resource-group "rg-name" --set hostnameConfigurations=$hostConfiguration
我明白了:
Unable to build a model: Cannot deserialize as [HostnameConfiguration] an object of type <class 'str'>, DeserializationError: Cannot deserialize as [HostnameConfiguration] an object of type <class'str'>
无法生成模型:无法反序列化为[HostnameConfiguration]类型的对象,反序列化错误:无法反序列化为[HostnameConfiguration]类型的对象
我这样做有什么问题?在存储到变量之前,必须将json转换为字符串 我利用了将json转换为字符串 更新的代码片段
$hostConfiguration ='[{\"hostName\":\"myhostname.com\",\"type\":\"Proxy\",\"keyVaultId\":\"https:\/\/mykeyvault.vault.azure.net\/secrets\/mysecret\"}]'
az apim update --name "apim-name" --resource-group "rg-name" --set hostnameConfigurations=$hostConfiguration
如果有帮助的话,请考虑接受这个解决方案:“是的!非常感谢。