Skip to content

Commit 795da06

Browse files
author
Maddie Clayton
authored
Merge pull request #6024 from anusapan/preview-IotHub
Add Basic Sku and Tag to IotHub
2 parents 7a5ebcc + b1af2f2 commit 795da06

File tree

50 files changed

+2695
-77062
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2695
-77062
lines changed

src/ResourceManager/IotHub/AzureRM.IotHub.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ CmdletsToExport = 'Add-AzureRmIotHubKey', 'Get-AzureRmIotHubEventHubConsumerGrou
8080
'Add-AzureRmIotHubEventHubConsumerGroup', 'New-AzureRmIotHub',
8181
'New-AzureRmIotHubExportDevices', 'New-AzureRmIotHubImportDevices',
8282
'Remove-AzureRmIotHub', 'Remove-AzureRmIotHubEventHubConsumerGroup',
83-
'Remove-AzureRmIotHubKey', 'Set-AzureRmIotHub',
83+
'Remove-AzureRmIotHubKey', 'Set-AzureRmIotHub', 'Update-AzureRmIotHub',
8484
'Add-AzureRmIotHubCertificate', 'Get-AzureRmIotHubCertificate',
8585
'Get-AzureRmIotHubCertificateVerificationCode',
8686
'Set-AzureRmIotHubVerifiedCertificate',

src/ResourceManager/IotHub/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
-->
2020
## Current Release
2121
* Set minimum dependency of module to PowerShell 5.0
22+
* Enable tags and Basic Sku to the IotHub
2223

2324
## Version 3.1.2
2425
* Updated to the latest version of the Azure ClientRuntime

src/ResourceManager/IotHub/Commands.IotHub.Test/Commands.IotHub.Test.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
<Reference Include="Microsoft.Azure.Common.NetFramework">
5050
<HintPath>..\..\..\packages\Microsoft.Azure.Common.2.1.0\lib\net45\Microsoft.Azure.Common.NetFramework.dll</HintPath>
5151
</Reference>
52-
<Reference Include="Microsoft.Azure.Management.IotHub, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
53-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.IotHub.1.1.3\lib\net452\Microsoft.Azure.Management.IotHub.dll</HintPath>
52+
<Reference Include="Microsoft.Azure.Management.IotHub, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
53+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.IotHub.2.0.0\lib\net452\Microsoft.Azure.Management.IotHub.dll</HintPath>
5454
<Private>True</Private>
5555
</Reference>
5656
<Reference Include="Microsoft.Azure.Test.Framework">
@@ -233,4 +233,4 @@
233233
<Target Name="AfterBuild">
234234
</Target>
235235
-->
236-
</Project>
236+
</Project>

src/ResourceManager/IotHub/Commands.IotHub.Test/ScenarioTests/IotHubTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ public IotHubTests(ITestOutputHelper output)
2828
XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
2929
}
3030

31-
[Fact(Skip = "Need service team to re-record test after changes to the ClientRuntime.")]
31+
[Fact]
3232
[Trait(Category.AcceptanceType, Category.CheckIn)]
3333
[Trait("Re-record", "ClientRuntime changes")]
3434
public void TestAzureIotHubLifeCycle()
3535
{
3636
IotHubController.NewInstance.RunPsTestWorkflow(
37-
() => { return new[] { string.Format("{0} {1} {2} {3} {4}", "Test-AzureRmIotHubLifecycle", "northeurope", "powershelliothub", "powershellrg", "S1") }; },
37+
() => { return new[] { "Test-AzureRmIotHubLifecycle" }; },
3838
null,
3939
null,
4040
TestUtilities.GetCallingClass(),
4141
TestUtilities.GetCurrentMethodName());
4242
}
4343

44-
[Fact(Skip = "Need service team to re-record test after changes to the ClientRuntime.")]
44+
[Fact]
4545
[Trait(Category.AcceptanceType, Category.CheckIn)]
4646
[Trait("Re-record", "ClientRuntime changes")]
4747
public void TestAzureIotHubCertificateLifeCycle()

src/ResourceManager/IotHub/Commands.IotHub.Test/ScenarioTests/IotHubTests.ps1

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,17 @@ Test Get-AzureRmIotHub for listing all iothubs in a subscription
2626

2727
function Test-AzureRmIotHubLifecycle
2828
{
29-
Param($Location, $IotHubName, $ResourceGroupName, $Sku)
29+
$Location = Get-Location "Microsoft.Devices" "IotHub"
30+
$IotHubName = getAssetName
31+
$ResourceGroupName = getAssetName
32+
$Sku = "B1"
33+
$namespaceName = getAssetName
34+
$eventHubName = getAssetName
35+
$authRuleName = getAssetName
36+
$Tag1Key = "key1"
37+
$Tag2Key = "key2"
38+
$Tag1Value = "value1"
39+
$Tag2Value = "value2"
3040

3141
# Get all Iot hubs in the subscription
3242
$allIotHubs = Get-AzureRmIotHub
@@ -38,7 +48,6 @@ function Test-AzureRmIotHubLifecycle
3848
$resourceGroup = New-AzureRmResourceGroup -Name $ResourceGroupName -Location $Location
3949

4050
Write-Debug " Create new eventHub "
41-
$namespaceName = "IotHubPSEHNamespaceTest"
4251
$result = New-AzureRmEventHubNamespace -ResourceGroup $ResourceGroupName -NamespaceName $namespaceName -Location $Location
4352

4453
Wait-Seconds 15
@@ -47,13 +56,11 @@ function Test-AzureRmIotHubLifecycle
4756
Assert-True {$result.ProvisioningState -eq "Succeeded"}
4857

4958
Write-Debug " Create new eventHub "
50-
$eventHubName = "IotHubPSEHTest"
5159
$msgRetentionInDays = 3
5260
$partionCount = 2
5361
$result = New-AzureRmEventHub -ResourceGroup $ResourceGroupName -NamespaceName $namespaceName -EventHubName $eventHubName -MessageRetentionInDays $msgRetentionInDays -PartitionCount $partionCount
5462

5563
# Create AuthRule
56-
$authRuleName = "IotHubPSEHAuthRule"
5764
$rights = "Listen","Send"
5865
$authRule = New-AzureRmEventHubAuthorizationRule -ResourceGroup $ResourceGroupName -NamespaceName $namespaceName -EventHubName $eventHubName -AuthorizationRuleName $authRuleName -Rights $rights
5966
$keys = Get-AzureRmEventHubKey -ResourceGroup $ResourceGroupName -NamespaceName $namespaceName -EventHubName $eventHubName -AuthorizationRuleName $authRuleName
@@ -226,13 +233,34 @@ function Test-AzureRmIotHubLifecycle
226233
$iotHubUpdated = Set-AzureRmIotHub -ResourceGroupName $ResourceGroupName -Name $IotHubName -FallbackRoute $iothub.Properties.Routing.FallbackRoute
227234
Assert-True { $iotHubUpdated.Properties.Routing.FallbackRoute.IsEnabled -eq 1}
228235

236+
# Add Tags to Iot Hub
237+
$tags = @{}
238+
$tags.Add($Tag1Key, $Tag1Value)
239+
$updatedIotHub = Update-AzureRmIotHub -ResourceGroupName $ResourceGroupName -Name $IotHubName -Tag $tags
240+
Assert-True { $updatedIotHub.Tags.Count -eq 1 }
241+
Assert-True { $updatedIotHub.Tags.Item($Tag1Key) -eq $Tag1Value }
242+
243+
# Add more Tags to Iot Hub
244+
$tags.Clear()
245+
$tags.Add($Tag2Key, $Tag2Value)
246+
$updatedIotHub = Update-AzureRmIotHub -ResourceGroupName $ResourceGroupName -Name $IotHubName -Tag $tags
247+
Assert-True { $updatedIotHub.Tags.Count -eq 2 }
248+
Assert-True { $updatedIotHub.Tags.Item($Tag1Key) -eq $Tag1Value }
249+
Assert-True { $updatedIotHub.Tags.Item($Tag2Key) -eq $Tag2Value }
250+
251+
# Add Tags to Iot Hub with Reset option
252+
$tags.Clear()
253+
$tags.Add($Tag1Key, $Tag1Value)
254+
$updatedIotHub = Update-AzureRmIotHub -ResourceGroupName $ResourceGroupName -Name $IotHubName -Tag $tags -Reset
255+
Assert-True { $updatedIotHub.Tags.Count -eq 1 }
256+
Assert-True { $updatedIotHub.Tags.Item($Tag1Key) -eq $Tag1Value }
257+
229258
# Remove IotHub
230259
Remove-AzureRmIotHub -ResourceGroupName $ResourceGroupName -Name $IotHubName
231260
}
232261

233262
function Test-AzureRmIotHubCertificateLifecycle
234263
{
235-
#Param($Location, $IotHubName, $ResourceGroupName, $Sku)
236264
$Location = Get-Location "Microsoft.Devices" "IotHub"
237265
$IotHubName = getAssetName
238266
$ResourceGroupName = getAssetName

0 commit comments

Comments
 (0)