Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Azure Stream Analytics is a real-time analytics and complex event-processing engine that is designed to analyze and process high volumes of fast streaming data from multiple sources simultaneously. This article will guide you through the process of creating and executing Azure Stream Analytics jobs using the Windows environment.
Before you begin, ensure you have the following:
If you haven't installed Azure CLI, you can do so by following these steps:
Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -ArgumentList '/I AzureCLI.msi /quiet' -Wait; Remove-Item .\AzureCLI.msi
Once Azure CLI is installed, you need to log in to your Azure account:
az login
This will open a web browser window for you to log in with your Azure credentials.
A resource group is a container that holds related resources for an Azure solution. Create a resource group using the following command:
az group create --name MyResourceGroup --location eastus
Now, create a Stream Analytics job using the following command:
az stream-analytics job create --name MyStreamAnalyticsJob --resource-group MyResourceGroup --location eastus --output-error-policy Stop
Define the input source (e.g., Azure Event Hub) and output sink (e.g., Azure SQL Database) for your Stream Analytics job.
az stream-analytics input create --job-name MyStreamAnalyticsJob --name MyInput --resource-group MyResourceGroup --type Stream --datasource EventHub --event-hub-namespace MyEventHubNamespace --event-hub-name MyEventHub --consumer-group $Default --shared-access-policy-name RootManageSharedAccessKey --shared-access-policy-key <YourAccessKey>
az stream-analytics output create --job-name MyStreamAnalyticsJob --name MyOutput --resource-group MyResourceGroup --datasource SQL --server MySqlServer.database.windows.net --database MyDatabase --table MyTable --user MyUser --password <YourPassword>
Define the query that processes the input data and sends the results to the output:
az stream-analytics transformation create --job-name MyStreamAnalyticsJob --resource-group MyResourceGroup --name MyTransformation --streaming-units 1 --query "SELECT * INTO MyOutput FROM MyInput"
Finally, start the Stream Analytics job:
az stream-analytics job start --name MyStreamAnalyticsJob --resource-group MyResourceGroup
You have successfully created and executed an Azure Stream Analytics job using the Windows environment. This guide covered the installation of Azure CLI, logging into Azure, creating a resource group, defining input and output, setting up the query, and starting the job.