Anteckning
Åtkomst till den här sidan kräver auktorisering. Du kan prova att logga in eller ändra kataloger.
Åtkomst till den här sidan kräver auktorisering. Du kan prova att ändra kataloger.
Kapslade distributionsresurser med yttre omfång bör inte användas för säkra parametrar eller list*-funktioner. Du kan exponera de säkra värdena i distributionshistoriken.
Linterregelkod
Använd följande värde i Bicep-konfigurationsfilen för att anpassa regelinställningar:
secure-params-in-nested-deploy
Lösning
Ange antingen distributionens properties.expressionEvaluationOptions.scope till inner eller använd en Bicep-modul i stället.
I följande exempel misslyckas det här testet eftersom en säker parameter refereras till i en kapslad distributionsresurs med yttre omfång.
@secure()
param secureValue string
resource nested 'Microsoft.Resources/deployments@2024-03-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: '2023-11-01'
location: '[resourceGroup().location]'
properties: {
securityRules: [
{
name: 'outerImplicit'
properties: {
description: format('{0}', secureValue)
protocol: 'Tcp'
}
}
]
}
}
]
}
}
}
Du kan åtgärda det genom att ange distributionens properties.expressionEvaluationOptions.scope till "inre":
@secure()
param secureValue string
resource nested 'Microsoft.Resources/deployments@2024-03-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: '2023-11-01'
location: '[resourceGroup().location]'
properties: {
securityRules: [
{
name: 'outerImplicit'
properties: {
description: format('{0}', secureValue)
protocol: 'Tcp'
}
}
]
}
}
]
}
}
}
Nästa steg
Mer information om linter finns i Använda Bicep-linter.