|
| 1 | +--- |
| 2 | +title: Azure Stream Analytics on Azure Stack |
| 3 | +description: Create Azure Stream Analytics edge job and deploy it to Azure Stack hub via IoT Edge runtime. |
| 4 | +ms.service: stream-analytics |
| 5 | +author: raan |
| 6 | +ms.author: raan |
| 7 | +ms.reviewer: mamccrea |
| 8 | +ms.topic: how-to |
| 9 | +ms.date:08/21/2020 |
| 10 | +ms.custom: seodec18 |
| 11 | +--- |
| 12 | + |
| 13 | +# Azure Stream Analytics on Azure Stack |
| 14 | + |
| 15 | +> [!IMPORTANT] |
| 16 | +> This functionality is in preview and is not recommended for use in production. |
| 17 | +
|
| 18 | +Azure Stream Analytics (ASA) can be run on Azure Stack Hub as an IoT Edge module. The module has added configuration that allows it to interact with blob storage, Event Hubs, IoT Hubs running in an Azure Stack Hub subscription by allowing custom URLs found in every Azure Stack Hub employment. The feature is currently in public preview. |
| 19 | + |
| 20 | +With this release, Azure Stream Analytics enables customers to build truly hybrid architectures for stream processing in their own private, autonomous cloud – connected or disconnected with cloud-native apps using consistent Azure services on premises. |
| 21 | + |
| 22 | +This article shows how to stream data from IoT Hub/Event Hub to another Event Hub or Blob Storage in an Azure Stack Hub subscription and process it with Azure Stream Analytics. |
| 23 | + |
| 24 | +## Set Up Environments |
| 25 | + |
| 26 | +### Prepare Azure Stack Hub Environment |
| 27 | + |
| 28 | +If you have an Azure Stack Hub, you will need a subscription. You can find a [tutorial for creating a subscription here.](https://docs.microsoft.com/azure-stack/user/azure-stack-subscribe-services/) |
| 29 | + |
| 30 | +If you would like to evaluate Azure Stack Hub on your own server, you can use the Azure Stack Development Kit (ASDK). For more information on the ASDK, read the [overview](https://docs.microsoft.com/azure-stack/asdk/) here. |
| 31 | + |
| 32 | +### Install IoT Edge runtime |
| 33 | + |
| 34 | +To run Azure Stream Analytics on Azure Stack Hub, the IoT Edge runtime is required on a device with network connectivity to the Azure Stack Hub or as a VM running on the Azure Stack Hub. The IoT Edge runtime allows ASA Edge jobs to integrate with Azure Storage and Azure Event Hubs which are running on your Azure Stack Hub. More information about [ASA Edge job can be seen here.](https://docs.microsoft.com/azure/stream-analytics/stream-analytics-edge) |
| 35 | + |
| 36 | +In addition to having network access to the Azure Stack Hub resources, the IoT Edge device (or VM) will need access to Azure IoT Hub in the Azure public cloud to enable configuration of the ASA module. |
| 37 | + |
| 38 | +These guides show how to set up the IoT Edge Runtime on your device or VM: |
| 39 | + |
| 40 | +1. Windows: |
| 41 | + https://docs.microsoft.com/en-us/azure/iot-edge/how-to-install-iot-edge-windows |
| 42 | +2. Linux: |
| 43 | + https://docs.microsoft.com/en-us/azure/iot-edge/how-to-install-iot-edge-linux |
| 44 | + |
| 45 | + |
| 46 | +## Create an Azure Stream Analytics Edge job |
| 47 | + |
| 48 | +### Create a storage account |
| 49 | + |
| 50 | +When you create an Azure Stream Analytics job to run on an IoT Edge device, it needs to be stored in a way that can be called from the device. You can use an existing Azure storage account or create a new one now. |
| 51 | +1. In the Azure portal, go to Create a **resource > Storage > Storage account - blob, file, table, queue.** |
| 52 | +2. Provide the following values to create your storage account: |
| 53 | + |
| 54 | +| **Field** | **Value** | |
| 55 | +| --- | --- | |
| 56 | +| Name | Provide a unique name for your storage account. | |
| 57 | +| Location | Choose a location close to you.| |
| 58 | +| Subscription | Choose the same subscription as your IoT hub.| |
| 59 | +| Resource Group | We recommend that you use the same resource group for all of the test resources that you create during the [IoT Edge quickstarts](https://docs.microsoft.com/azure/iot-edge/quickstart) and tutorials. For example, **IoTEdgeResources**. | |
| 60 | + |
| 61 | +3. Keep the default values for the other fields and select **Create**. |
| 62 | + |
| 63 | + |
| 64 | +### Create a new job |
| 65 | + |
| 66 | +1. In the Azure portal, go to **Create a resource > Internet of Things > Stream Analytics Job**. |
| 67 | +2. Provide the following values to create your storage account: |
| 68 | + |
| 69 | +| **Field** | **Value** | |
| 70 | +| --- | --- | |
| 71 | +| Job Name | Provide a name for your job. For example, **IoTEdgeJob** | |
| 72 | +| Subscription | Choose the same subscription as your IoT hub.| |
| 73 | +| Resource Group | We recommend that you use the same resource group for all of the test resources that you create during the [IoT Edge quickstarts](https://docs.microsoft.com/azure/iot-edge/quickstart) and tutorials. For example, **IoTEdgeResources**. | |
| 74 | +| Location | Choose a location close to you. | |
| 75 | +| Hosting Environment | Select **Edge**. | |
| 76 | + |
| 77 | +3. Select **Create**. |
| 78 | + |
| 79 | +### Configure your job |
| 80 | + |
| 81 | +Once your Stream Analytics job is created in the Azure portal, you can configure it with an input, an output, and a query to run on the data that passes through. **This preview allows you to manually specify inputs from an IoT Hub or Event Hub in an Azure Stack Hub subscription. Likewise, an Event Hub or Storage Account in an Azure Stack Hub subscription can be used as an output which you manually specify.** |
| 82 | + |
| 83 | +Using the three elements of input, output, and query, to configure a job. |
| 84 | +1. Navigate to your Stream Analytics job in the Azure portal. |
| 85 | +2. Under **Configure**, select **Storage account settings** and choose the right storage account set up in the previous step. |
| 86 | + |
| 87 | +3. Under **Job Topology**, select **Inputs** then **Add stream input.** |
| 88 | +4. Choose **IoT Hub/Event Hub/Edge Hub** from the drop-down list. |
| 89 | +5. If the input is an Event Hub or IoT Hub in an Azure Stack Hub subscription, please provide information manually as shown below. |
| 90 | + |
| 91 | +Event Hub: |
| 92 | +- Input alias |
| 93 | +- Service Bus namespace (Example: *sb://<Event Hub Name>.eventhub.shanghai.azurestack.corp.microsoft.com*) |
| 94 | +- Event Hub name |
| 95 | +- Event Hub policy name |
| 96 | +- Event Hub policy key |
| 97 | +- Event Hub consumer group(optional) |
| 98 | +- Partition count |
| 99 | + |
| 100 | + |
| 101 | +IoT Hub: |
| 102 | +- Input alias |
| 103 | +- IoT Hub (Example:*<IoT Hub Name>.shanghai.azurestack.corp.microsoft.com*) |
| 104 | +- Shared access policy name |
| 105 | +- Shared access policy key |
| 106 | +- Consumer group (optional) |
| 107 | +- Partition count |
| 108 | + |
| 109 | + |
| 110 | +6. Keep the default values for the other fields, and select Save. |
| 111 | +7. Under Job Topology, open Outputs then select Add. |
| 112 | +8. Choose Blob Storage/Event Hub/Edge Hub from the drop-down list. |
| 113 | +9. If the output is an Event Hub or Blob Storage in an Azure Stack Hub subscription, please provide information manually as shown below. |
| 114 | + |
| 115 | +Event Hub: |
| 116 | +- Output alias |
| 117 | +- Service Bus namespace (Example: *sb://<Event Hub Name>.eventhub.shanghai.azurestack.corp.microsoft.com*) |
| 118 | +- Event Hub name |
| 119 | +- Event Hub policy name |
| 120 | +- Event Hub policy key |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | +Blob Storage: |
| 125 | +- Output alias |
| 126 | +- Storage account (Example: *<Storage Account Name>.blob.shanghai.azurestack.corp.microsoft.com*) |
| 127 | +- Storage account key |
| 128 | + |
| 129 | +Note: Parquet format hasn't been supported yet for edge jobs on Azure Stack Hub. For Minimum rows and Maximum time, please use 0 or leave it blank. |
| 130 | + |
| 131 | + |
| 132 | +## Deploy ASA on your VM or Device which is connected to your Azure Stack |
| 133 | + |
| 134 | +1. In the Azure portal, open IoT Hub, navigate to **IoT Edge** and click on the device (VM) you want to target for this deployment. |
| 135 | +2. Select **Set modules**, then select **+ Add** and choose **Azure Stream Analytics Module**. |
| 136 | +3. Select the subscription and the ASA Edge job that you created. Click **Save** and select **Next:Routes**. |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | +4. Click **Review+create >** |
| 141 | +5. In the **Review + create** step, select **Create**. |
| 142 | + |
| 143 | +6. Confirm that the module is added to the list. |
| 144 | + |
| 145 | + |
| 146 | +## Next steps |
| 147 | +- [Azure Stream Analytics on IoT Edge](https://docs.microsoft.com/azure/stream-analytics/stream-analytics-edge) |
| 148 | +- [Develop Stream Analytics Edge jobs](https://docs.microsoft.com/stream-analytics-query/stream-analytics-query-language-reference) |
0 commit comments