添加 AzIotHubRoutingEndpoint cmdlet

Add-AzIotHubRoutingEndpoint cmdlet

我需要通过 PowerShell 为我的 Iot Hub 创建一些自定义端点。 cmdlet Add-AzIotHubRoutingEndpoint 是不够的,因为它不提供自定义 BatchFrequencyInSeconds 和 MaxChunkSizeInBytes 属性的可能性。

这能以某种方式实现吗?

我找到了解决办法。 Set-AzIotHub 有一个参数 -RoutingProperties,通过这种方式您可以实现更好的自定义。我所做的是:

# Create an endpoint object
$customEndpoint = New-Object "Microsoft.Azure.Commands.Management.IotHub.Models.PSRoutingStorageContainerEndpoint"
# Set its contents...

# Get the routing properties from your Iot Hub
$routingProperties = $iotHub.Properties.Routing
# Add this endpoint to the specified category, mine was a storage container endpoint
$routingProperties.Endpoints.StorageContainers.Add($customEndpoint)

# Then call Set-AzIotHub
$iotHub = Set-AzIotHub `
    -ResourceGroupName $ResourceGroupName `
    -Name "$($ResourceGroupName)$($IotHubSettings.NameSuffix)" `
    -RoutingProperties $routingProperties