Skip to content

ks6088ts-labs/azure-iot-stream-analytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

infra

Azure IoT Stream Analytics

Prerequisites

Get Started

Create resources

azd up --environment iot-stream-analytics

Play with Azure IoT Stream Analytics

Run the following commands in your local environment.

# Set parameters
IOTHUB_NAME=$(terraform output -state=.azure/iot-stream-analytics/infra/terraform.tfstate -raw iothub_name)
STREAM_ANALYTICS_JOB_NAME=$(terraform output -state=.azure/iot-stream-analytics/infra/terraform.tfstate -raw stream_analytics_job_name)
DEVICE_NAME="myDevice"

# Create a device identity
az iot hub device-identity create \
    --hub-name $IOTHUB_NAME \
    --device-id $DEVICE_NAME

# Get the device connection string
CONNECTION_STRING=$(az iot hub device-identity connection-string show \
    --hub-name $IOTHUB_NAME \
    --device-id $DEVICE_NAME \
    --query "connectionString" \
    --output tsv)

# Start stream analytics job
az stream-analytics job start \
    --job-name $STREAM_ANALYTICS_JOB_NAME \
    --resource-group rg-iot-stream-analytics

To send mock data run the following procedures in your local environment.

  1. Open Raspberry Pi Azure IoT Online Simulator
  2. Override connectionString to $CONNECTION_STRING of your device connection string
  3. Click Start to send data
  4. Go to storage container to see the data

Clean up resources

azd down --force

CI/CD

SUBSCRIPTION_ID="$(az account list --query "[?isDefault].id" -o tsv)"

az ad sp create-for-rbac \
    --name "iot-stream-analytics" \
    --role contributor \
    --scopes /subscriptions/f7b447fb-636e-49c2-ae1c-81120dc5e304/resourceGroups/rg-iot-stream-analytics \
    --sdk-auth > .azure/credentials.json

gh secret set AZURE_CREDENTIALS < .azure/credentials.json

References

About

IoT stream analytics service on Azure

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages