@@ -88,7 +88,13 @@ function Test-AzureRmIotHubLifecycle
88
88
$routingProperties.Routes = New-Object ' System.Collections.Generic.List[Microsoft.Azure.Commands.Management.IotHub.Models.PSRouteMetadata]'
89
89
$routingProperties.Routes.Add ($routeProp )
90
90
$properties.Routing = $routingProperties
91
- $newIothub1 = New-AzIotHub - Name $IotHubName - ResourceGroupName $ResourceGroupName - Location $Location - SkuName $Sku - Units 1 - Properties $properties
91
+
92
+ # Add Tags to Iot Hub
93
+ $tags = @ {}
94
+ $tags.Add ($Tag1Key , $Tag1Value )
95
+
96
+ # Create new Iot Hub
97
+ $newIothub1 = New-AzIotHub - Name $IotHubName - ResourceGroupName $ResourceGroupName - Location $Location - SkuName $Sku - Units 1 - Properties $properties - tag $tags
92
98
93
99
# Get Iot Hub in resourcegroup
94
100
$allIotHubsInResourceGroup = Get-AzIotHub - ResourceGroupName $ResourceGroupName
@@ -103,6 +109,8 @@ function Test-AzureRmIotHubLifecycle
103
109
Assert-True { $iotHub.Properties.Routing.Routes.Count -eq 1 }
104
110
Assert-True { $iotHub.Properties.Routing.Routes [0 ].Name -eq " route" }
105
111
Assert-True { $iotHub.Properties.Routing.Endpoints.EventHubs [0 ].Name -eq " eh1" }
112
+ Assert-True { $iotHub.Tags.Count -eq 1 }
113
+ Assert-True { $iotHub.Tags.Item ($Tag1Key ) -eq $Tag1Value }
106
114
107
115
# Get Quota Metrics
108
116
$quotaMetrics = Get-AzIotHubQuotaMetric - ResourceGroupName $ResourceGroupName - Name $IotHubName
@@ -238,13 +246,6 @@ function Test-AzureRmIotHubLifecycle
238
246
$iotHubUpdated = Set-AzIotHub - ResourceGroupName $ResourceGroupName - Name $IotHubName - FallbackRoute $iothub.Properties.Routing.FallbackRoute
239
247
Assert-True { $iotHubUpdated.Properties.Routing.FallbackRoute.IsEnabled -eq 1 }
240
248
241
- # Add Tags to Iot Hub
242
- $tags = @ {}
243
- $tags.Add ($Tag1Key , $Tag1Value )
244
- $updatedIotHub = Update-AzIotHub - ResourceGroupName $ResourceGroupName - Name $IotHubName - Tag $tags
245
- Assert-True { $updatedIotHub.Tags.Count -eq 1 }
246
- Assert-True { $updatedIotHub.Tags.Item ($Tag1Key ) -eq $Tag1Value }
247
-
248
249
# Add more Tags to Iot Hub
249
250
$tags.Clear ()
250
251
$tags.Add ($Tag2Key , $Tag2Value )
0 commit comments