Azure IoT Hubのメッセージルーティング
6652 ワード
アーキテクチャ
事前準備
上記の赤色については別の投稿を参照してください。
Raspberry Pi(Python)からAzure IoT Hubへテレメトリーを送信する
Azure IoT Hubのメッセージルーティング
情報定義
resourceGroupName={ResourceGroupName}
iotHubName={IoTHubName}
ioteviceName={IoTDeviceName}
storageAccountName={StorageAccountName}
containerName={ContainerName}
endpointName={EndpointName}
endpointType={EndpointType}
routeName={RouteName}
情報取得
subscriptionID=$(az account show --query id)
Storage Account作成
az storage account create \
--name $storageAccountName \
--resource-group $resourceGroup \
--location $location \
--sku Standard_LRS
Storage Accountキー取得
storageAccountKey=$(az storage account keys list \
--resource-group $resourceGroup \
--account-name $storageAccountName \
--query "[0].value" | tr -d '"')
Storage Accountコンテナー作成
az storage container create --name $containerName \
--account-name $storageAccountName \
--account-key $storageAccountKey \
--public-access off
Storage Accountの接続情報取得
storageConnectionString=$(az storage account show-connection-string \
--name $storageAccountName \
--query connectionString \
-o tsv)
IoT Hubのエンドポイント作成
az iot hub routing-endpoint create \
--connection-string $storageConnectionString \
--endpoint-name $endpointName \
--endpoint-resource-group $resourceGroup \
--endpoint-subscription-id $subscriptionID \
--endpoint-type $endpointType \
--hub-name $iotHubName \
--container $containerName \
--resource-group $resourceGroup \
--encoding json
IoT Hubのメッセージルーティング作成
az iot hub route create \
--name $routeName \
--hub-name $iotHubName \
--source devicemessages \
--resource-group $resourceGroup \
--endpoint-name $endpointName \
--enabled
https://docs.microsoft.com/en-us/azure/iot-hub/tutorial-routing
resourceGroupName={ResourceGroupName}
iotHubName={IoTHubName}
ioteviceName={IoTDeviceName}
storageAccountName={StorageAccountName}
containerName={ContainerName}
endpointName={EndpointName}
endpointType={EndpointType}
routeName={RouteName}
subscriptionID=$(az account show --query id)
az storage account create \
--name $storageAccountName \
--resource-group $resourceGroup \
--location $location \
--sku Standard_LRS
storageAccountKey=$(az storage account keys list \
--resource-group $resourceGroup \
--account-name $storageAccountName \
--query "[0].value" | tr -d '"')
az storage container create --name $containerName \
--account-name $storageAccountName \
--account-key $storageAccountKey \
--public-access off
storageConnectionString=$(az storage account show-connection-string \
--name $storageAccountName \
--query connectionString \
-o tsv)
az iot hub routing-endpoint create \
--connection-string $storageConnectionString \
--endpoint-name $endpointName \
--endpoint-resource-group $resourceGroup \
--endpoint-subscription-id $subscriptionID \
--endpoint-type $endpointType \
--hub-name $iotHubName \
--container $containerName \
--resource-group $resourceGroup \
--encoding json
az iot hub route create \
--name $routeName \
--hub-name $iotHubName \
--source devicemessages \
--resource-group $resourceGroup \
--endpoint-name $endpointName \
--enabled
https://docs.microsoft.com/en-us/azure/iot-hub/tutorial-routing
Author And Source
この問題について(Azure IoT Hubのメッセージルーティング), 我々は、より多くの情報をここで見つけました https://qiita.com/motoJinC25/items/cc6e76f2b73000410b60著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .