Azure APIM策略:从NameValue渲染托管标识资源值的问题与解决
Azure APIM托管标识Resource值渲染问题解决
问题说明
通过Terraform部署Azure APIM策略时,需从NameValue中读取对应值作为<authentication-managed-identity>的resource参数,先后尝试两种写法均未达到预期效果:
- 写法1:
<authentication-managed-identity resource="{{CRM-EWR-Resource-Client-Id}}" />,部署后原字符串未被替换,仍保留{{CRM-EWR-Resource-Client-Id}} - 写法2:
<authentication-managed-identity resource="CRM-EWR-Resource-Client-Id" />,部署后未渲染出目标值de08357d-b6c-454-wew-21321sd
可行方案
通过先将NameValue中的值存入变量,再使用表达式引用变量的方式成功实现值的渲染:
<set-variable name="test" value="{{CRM-EWR-Resource-Client-Id_dev}}" /> <authentication-managed-identity resource="@(context.Variables["test"] as string)" />
内容的提问来源于stack exchange,提问作者Ali
相关产品推荐
相关产品推荐

