빠른 시작: Bicep을 사용하여 Azure Stream Analytics 작업 만들기

이 빠른 시작에서는 Bicep을 사용하여 Azure Stream Analytics 작업을 만드는 방법을 보여 줍니다. 작업을 만든 후에는 배포의 유효성을 검사합니다.

Bicep은 선언적 구문을 사용하여 Azure 리소스를 배포하는 DSL(도메인 특정 언어)입니다. 간결한 구문, 신뢰할 수 있는 형식 안전성 및 코드 다시 사용에 대한 지원을 제공합니다. Bicep은 Azure에서 코드형 인프라 솔루션에 대한 최고의 제작 환경을 제공합니다.

필수 조건

이 문서를 완료하려면 Azure 구독이 필요합니다. 체험 계정 만들기

Bicep 파일 검토

이 빠른 시작에서 사용되는 Bicep 파일은 Azure 빠른 시작 템플릿에서 나온 것입니다.

@description('Location for the resources.')
param location string = resourceGroup().location

@description('Stream Analytics Job Name, can contain alphanumeric characters and hypen and must be 3-63 characters long')
@minLength(3)
@maxLength(63)
param streamAnalyticsJobName string

@description('You can choose the number of Streaming Units, ranging from 3, 7, 10, 20, 30, in multiples of 10, and continuing up to 660.')
@minValue(3)
@maxValue(660)

param numberOfStreamingUnits int

resource streamingJob 'Microsoft.StreamAnalytics/streamingjobs@2021-10-01-preview' = {
  name: streamAnalyticsJobName
  location: location
  properties: {
    sku: {
      name: 'StandardV2'
    }
    outputErrorPolicy: 'Stop'
    eventsOutOfOrderPolicy: 'Adjust'
    eventsOutOfOrderMaxDelayInSeconds: 0
    eventsLateArrivalMaxDelayInSeconds: 5
    dataLocale: 'en-US'
    transformation: {
      name: 'Transformation'
      properties: {
        streamingUnits: numberOfStreamingUnits
        query: 'SELECT\r\n    *\r\nINTO\r\n    [YourOutputAlias]\r\nFROM\r\n    [YourInputAlias]'
      }
    }
  }
}

output location string = location
output name string = streamingJob.name
output resourceGroupName string = resourceGroup().name
output resourceId string = streamingJob.id

Bicep 파일에 정의된 Azure 리소스는 Microsoft.StreamAnalytics/StreamingJobs: Azure Stream Analytics 작업 만들기입니다.

Bicep 파일 배포

  1. Bicep 파일을 main.bicep으로 로컬 컴퓨터에 저장합니다.

  2. Azure CLI 또는 Azure PowerShell을 사용하여 Bicep 파일을 배포합니다.

    az group create --name exampleRG --location eastus
    az deployment group create --resource-group exampleRG --template-file main.bicep --parameters streamAnalyticsJobName =<job-name> numberOfStreamingUnits=<int>
    

    다음 매개 변수에 대한 값을 제공해야 합니다.

    • streamAnalyticsJobName: <job-name>을 Stream Analytics 작업 이름으로 바꿉니다. 이름은 영숫자 문자와 하이픈을 포함할 수 있으며 길이는 3~63자여야 합니다.
    • numberOfStreamingUnits: <int>를 스트리밍 단위 수로 바꿉니다. 허용되는 값은 1, 3, 6, 12, 18, 24, 30, 36, 42, 48입니다.

    참고 항목

    배포가 완료되면 배포에 성공했음을 나타내는 메시지가 표시됩니다.

배포된 리소스 검토

Azure Portal을 사용하여 Azure Stream Analytics 작업을 확인하거나 다음 Azure CLI 또는 Azure PowerShell 스크립트를 사용하여 리소스를 나열합니다.

Azure CLI

Azure Portal, Azure CLI 또는 Azure PowerShell을 사용하여 리소스 그룹에 배포된 리소스를 나열합니다.

az resource list --resource-group exampleRG

리소스 정리

후속 자습서를 계속 진행하려는 경우 이러한 리소스를 그대로 유지하는 것이 좋습니다. 더 이상 필요하지 않는 경우 리소스 그룹을 삭제하면 Azure Stream Analytics 작업이 삭제됩니다. Azure CLI 또는 Azure PowerShell을 사용하여 리소스 그룹을 삭제하려면 다음을 수행합니다.

az group delete --name exampleRG

다음 단계

이 빠른 시작에서는 Bicep을 사용하는 Azure Stream Analytics 작업을 만들고 배포의 유효성을 검사했습니다. Visual Studio Code를 사용하여 고유한 Bicep 파일을 만드는 방법을 알아보려면 다음 문서를 계속 진행하세요.