Upgrade to 1.5.2, tooling for VPN API requests
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get all devices from an IoT Hub (iothub_name) that have the given tag (tag_key == tag_value)
|
||||
# Can also filter using tags.number
|
||||
# Execute an Azure command for each of the devices found
|
||||
# Here the command will configure the modules of all the IoT Edge devices of Danish (as Danish have up to 29 devices) with the given template.
|
||||
|
||||
iothub_name="IotHub-CUBE-Prod"
|
||||
|
||||
tag_key="site"
|
||||
tag_value="DANISH"
|
||||
|
||||
json_output=$(az iot hub query --hub-name $iothub_name --query-command "SELECT * FROM devices WHERE tags.$tag_key = '$tag_value' AND tags.number != '30' AND capabilities.iotEdge = true" --output json)
|
||||
|
||||
hashmap=$(echo "$json_output" | jq -r 'map({key: .tags.number, value: .deviceId}) | from_entries')
|
||||
|
||||
for key in $(echo "$hashmap" | jq -r 'keys | map(tonumber) | sort_by(.) | .[]'); do
|
||||
value=$(jq -r --arg k "$key" '.[$k]' <<< "$hashmap")
|
||||
|
||||
az iot edge set-modules --device-id $value --hub-name $iothub_name --content moxa_ac_template_1.5_patch.json
|
||||
done
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
# Get all devices from an IoT Hub (iothub_name) that have the given tag (tag_key == tag_value)
|
||||
# Can also filter using tags.number
|
||||
# Execute an Azure command for each of the devices found
|
||||
# Here the command will configure the modules of all the IoT Edge devices of Danish (as Danish have up to 29 devices) with the given template.
|
||||
|
||||
iothub_name="IotHub-CUBE-Prod"
|
||||
|
||||
tag_key="site"
|
||||
tag_value="DANISH"
|
||||
|
||||
json_output=$(az iot hub query --hub-name $iothub_name --query-command "SELECT * FROM devices WHERE tags.$tag_key = '$tag_value' AND tags.number != '30' AND capabilities.iotEdge = true" --output json)
|
||||
|
||||
hashmap=$(echo "$json_output" | jq -r 'map({key: .tags.number, value: .deviceId}) | from_entries')
|
||||
|
||||
for key in $(echo "$hashmap" | jq -r 'keys | map(tonumber) | sort_by(.) | .[]'); do
|
||||
value=$(jq -r --arg k "$key" '.[$k]' <<< "$hashmap")
|
||||
|
||||
az iot edge set-modules --device-id $value --hub-name $iothub_name --content moxa_ac_template_1.5_patch.json
|
||||
done
|
||||
|
||||
echo $hashmap
|
||||
Reference in New Issue
Block a user