قاعدة Linter - المعلمات الآمنة في التوزيع المتداخل
يجب ألا تستخدم موارد النشر المتداخلة ذات النطاق الخارجي للمعلمات الآمنة أو دالات القائمة* . يمكنك عرض القيم الآمنة في محفوظات النشر.
التعليمة البرمجية لقاعدة Linter
استخدم القيمة التالية في ملف تكوين Bicep لتخصيص إعدادات القاعدة:
secure-params-in-nested-deploy
حل
قم إما بتعيين خصائص التوزيع.expressionEvaluationOptions.scope إلى inner
وحدة Bicep النمطية أو استخدامها بدلا من ذلك.
فشل المثال التالي في هذا الاختبار لأنه تتم الإشارة إلى معلمة آمنة في مورد نشر متداخل خارجي النطاق.
@secure()
param secureValue string
resource nested 'Microsoft.Resources/deployments@2021-04-01' = {
name: 'nested'
properties: {
mode: 'Incremental'
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
variables: {}
resources: [
{
name: 'outerImplicit'
type: 'Microsoft.Network/networkSecurityGroups'
apiVersion: '2019-11-01'
location: '[resourceGroup().location]'
properties: {
securityRules: [
{
name: 'outerImplicit'
properties: {
description: format('{0}', secureValue)
protocol: 'Tcp'
}
}
]
}
}
]
}
}
}
يمكنك إصلاحه عن طريق تعيين خصائص التوزيع.expressionEvaluationOptions.scope إلى 'inner':
@secure()
param secureValue string
resource nested 'Microsoft.Resources/deployments@2021-04-01' = {
name: 'nested'
properties: {
mode: 'Incremental'
expressionEvaluationOptions: {
scope: 'Inner' // Set to inner scope
}
template: {
'$schema': 'https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#'
contentVersion: '1.0.0.0'
variables: {}
resources: [
{
name: 'outerImplicit'
type: 'Microsoft.Network/networkSecurityGroups'
apiVersion: '2019-11-01'
location: '[resourceGroup().location]'
properties: {
securityRules: [
{
name: 'outerImplicit'
properties: {
description: format('{0}', secureValue)
protocol: 'Tcp'
}
}
]
}
}
]
}
}
}
الخطوات التالية
لمزيد من المعلومات حول linter، راجعاستخدام Bicep linter.