Linter 규칙 - 아티팩트 매개 변수

이 규칙은 아티팩트 매개 변수가 올바르게 정의되었는지 여부를 확인합니다. 이 테스트를 통과하려면 다음 조건을 충족해야 합니다.

  • 하나의 매개 변수(_artifactsLocation 또는 _artifactsLocationSasToken)를 제공하는 경우 다른 매개 변수를 제공해야 합니다.
  • _artifactsLocation은 문자열이어야 합니다.
  • _artifactsLocation에 기본값이 있는 경우 deployment().properties.templateLink.uri이거나 기본값의 원시 URL이어야 합니다.
  • _artifactsLocationSasToken은 보안 문자열 이어야 합니다.
  • _artifactsLocationSasToken에 기본값이 있는 경우 빈 문자열이어야 합니다.
  • 참조된 모듈에 _artifactsLocation 또는 _artifactsLocationSasToken 매개 변수가 있는 경우 모듈에 기본값이 있더라도 해당 매개 변수에 대한 값을 전달해야 합니다.

Linter 규칙 코드

Bicep 구성 파일의 다음 값을 사용하여 규칙 설정을 사용자 지정합니다.

artifacts-parameters

솔루션

다음 예제는 _artifactsLocationSasToken이 누락되었으므로 이 테스트에 실패합니다.

@description('The base URI where artifacts required by this template are located including a trailing \'/\'')
param _artifactsLocation string = deployment().properties.templateLink.uri

...

다음 예제에서는 기본값이 제공되고 기본 _artifactsLocationSasToken 값이 빈 문자열이 아닌 경우 원시 URL이어야 deployment().properties.templateLink.uri 하므로 이 테스트 _artifactsLocation 에 실패합니다.

@description('The base URI where artifacts required by this template are located including a trailing \'/\'')
param _artifactsLocation string = 'something'

@description('SAS Token for accessing script path')
@secure()
param _artifactsLocationSasToken string = 'something'

...

이 예제에서는 해당 테스트를 통과합니다.

@description('The base URI where artifacts required by this template are located including a trailing \'/\'')
param _artifactsLocation string = deployment().properties.templateLink.uri

@description('SAS Token for accessing script path')
@secure()
param _artifactsLocationSasToken string = ''

...

다음 단계

Linter에 관한 자세한 내용은 Bicep Linter 사용을 참조하세요.