你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
当为函数提供具有错误数据类型的参数时,会发生此诊断。
说明
类型 <参数类型的> 参数不能分配给类型 <参数类型的>参数。
Level
错误
解决方案
提供具有正确数据类型的参数。
示例
下面的示例引发诊断,因为 contains() 当函数与字符串一起使用作为第一个参数时,需要字符串作为第二个参数,但提供了整数:
output stringTrue bool = contains('OneTwoThree', 2)
可以使用字符串作为第二个参数来修复诊断:
output stringTrue bool = contains('OneTwoThree', 'Two')
后续步骤
有关 Bicep 诊断的详细信息,请参阅 Bicep 核心诊断。