Skip to content

Commit 8322965

Browse files
authored
[IoT]IoT Hub SDK version update to 4.2.0 and fixed Get-AzIoTHub to work with DigiCert hubs (#20938)
* IoT Hub SDK version update to 4.2.0 and fixed Get-AzIoTHub to work with DigiCert hubs * Remove CertificateBodyDescription creation * Reconfigure EventHubConsumerGroupName property * update dps session records * Fix DPS tests
1 parent fcc0121 commit 8322965

File tree

22 files changed

+7061
-8078
lines changed

22 files changed

+7061
-8078
lines changed

src/DeviceProvisioningServices/DeviceProvisioningServices.Test/DeviceProvisioningServices.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<ItemGroup>
1414
<PackageReference Include="Microsoft.Azure.Devices" Version="1.22.0" />
1515
<PackageReference Include="Microsoft.Azure.Management.DeviceProvisioningServices" Version="0.10.0-preview" />
16-
<PackageReference Include="Microsoft.Azure.Management.IotHub" Version="3.0.1" />
16+
<PackageReference Include="Microsoft.Azure.Management.IotHub" Version="4.2.0" />
1717
</ItemGroup>
1818

1919
</Project>

src/DeviceProvisioningServices/DeviceProvisioningServices.Test/ScenarioTests/IotDpsAccessPolicyTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function Test-AzureIotDpsAccessPolicyLifeCycle
3030

3131
# Constant variable
3232
$AccessPolicyDefaultKeyName = "provisioningserviceowner"
33-
$AccessPolicyDefaultRights = "ServiceConfig, DeviceConnect, EnrollmentWrite"
33+
$AccessPolicyDefaultRights = "ServiceConfig, EnrollmentWrite, DeviceConnect"
3434
$NewAccessPolicyKeyName = "Access1"
3535
$NewAccessPolicyRights = "ServiceConfig"
3636

src/DeviceProvisioningServices/DeviceProvisioningServices.Test/ScenarioTests/IotDpsEnrollmentGroupTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function Test-AzIotDpsEnrollmentGroupLifeCycle
5252
Assert-True { $iotHub.Name -eq $IotHubName }
5353

5454
# Add a key to IoT Hub
55-
$hubKeys = Add-AzIoTHubKey -Name $IotHubName -ResourceGroupName $ResourceGroupName -KeyName $hubKeyName -Rights ServiceConnect
55+
$hubKeys = Add-AzIoTHubKey -Name $IotHubName -ResourceGroupName $ResourceGroupName -KeyName $hubKeyName -Rights RegistryWrite,ServiceConnect
5656
Assert-True { $hubKeys.Count -gt 1 }
5757

5858
# Get key information from IoT Hub

src/DeviceProvisioningServices/DeviceProvisioningServices.Test/ScenarioTests/IotDpsEnrollmentTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function Test-AzIotDpsEnrollmentLifeCycle
5555
Assert-True { $iotHub.Name -eq $IotHubName }
5656

5757
# Add a key to IoT Hub
58-
$hubKeys = Add-AzIoTHubKey -Name $IotHubName -ResourceGroupName $ResourceGroupName -KeyName $hubKeyName -Rights ServiceConnect
58+
$hubKeys = Add-AzIoTHubKey -Name $IotHubName -ResourceGroupName $ResourceGroupName -KeyName $hubKeyName -Rights RegistryWrite,ServiceConnect
5959
Assert-True { $hubKeys.Count -gt 1 }
6060

6161
# Get key information from IoT Hub

src/DeviceProvisioningServices/DeviceProvisioningServices.Test/ScenarioTests/IotDpsLinkedHubTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function Test-AzureIotDpsLinkedHubLifeCycle
4848
Assert-True { $iotHub.Name -eq $IotHubName }
4949

5050
# Add a key to IoT Hub
51-
$hubKeys = Add-AzIoTHubKey -Name $IotHubName -ResourceGroupName $ResourceGroupName -KeyName $hubKeyName -Rights ServiceConnect
51+
$hubKeys = Add-AzIoTHubKey -Name $IotHubName -ResourceGroupName $ResourceGroupName -KeyName $hubKeyName -Rights ServiceConnect,RegistryWrite
5252
Assert-True { $hubKeys.Count -gt 1 }
5353

5454
# Get key information from IoT Hub

src/DeviceProvisioningServices/DeviceProvisioningServices.Test/ScenarioTests/IotDpsRegistrationTests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function Test-AzIotDpsRegistrationLifeCycle
5050
Assert-True { $iotHub.Name -eq $IotHubName }
5151

5252
# Add a key to IoT Hub
53-
$hubKeys = Add-AzIoTHubKey -Name $IotHubName -ResourceGroupName $ResourceGroupName -KeyName $hubKeyName -Rights ServiceConnect
53+
$hubKeys = Add-AzIoTHubKey -Name $IotHubName -ResourceGroupName $ResourceGroupName -KeyName $hubKeyName -Rights RegistryWrite,ServiceConnect
5454
Assert-True { $hubKeys.Count -gt 1 }
5555

5656
# Get key information from IoT Hub

src/DeviceProvisioningServices/DeviceProvisioningServices.Test/SessionRecords/Commands.DeviceProvisioningServices.Test.IotDpsAccessPolicyTests/IotDpsAccessPolicyLifeCycle.json

Lines changed: 378 additions & 489 deletions
Large diffs are not rendered by default.

src/DeviceProvisioningServices/DeviceProvisioningServices.Test/SessionRecords/Commands.DeviceProvisioningServices.Test.IotDpsEnrollmentGroupTests/IotDpsEnrollmentGroupLifeCycle.json

Lines changed: 1071 additions & 1245 deletions
Large diffs are not rendered by default.

src/DeviceProvisioningServices/DeviceProvisioningServices.Test/SessionRecords/Commands.DeviceProvisioningServices.Test.IotDpsEnrollmentTests/IotDpsEnrollmentLifeCycle.json

Lines changed: 1139 additions & 1313 deletions
Large diffs are not rendered by default.

src/DeviceProvisioningServices/DeviceProvisioningServices.Test/SessionRecords/Commands.DeviceProvisioningServices.Test.IotDpsLinkedHubTests/IotDpsLinkedHubLifeCycle.json

Lines changed: 593 additions & 875 deletions
Large diffs are not rendered by default.

src/DeviceProvisioningServices/DeviceProvisioningServices.Test/SessionRecords/Commands.DeviceProvisioningServices.Test.IotDpsRegistrationTests/IotDpsRegistrationLifeCycle.json

Lines changed: 759 additions & 933 deletions
Large diffs are not rendered by default.

src/DeviceProvisioningServices/DeviceProvisioningServices.Test/SessionRecords/Commands.DeviceProvisioningServices.Test.IotDpsTests/IotDpsLifeCycle.json

Lines changed: 281 additions & 387 deletions
Large diffs are not rendered by default.

src/IotHub/IotHub.Test/IotHub.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<ItemGroup>
1515
<PackageReference Include="Microsoft.Azure.Devices" Version="1.22.0" />
1616
<PackageReference Include="Microsoft.Azure.Management.EventHub" Version="5.0.0" />
17-
<PackageReference Include="Microsoft.Azure.Management.IotHub" Version="3.0.1" />
17+
<PackageReference Include="Microsoft.Azure.Management.IotHub" Version="4.2.0" />
1818
<PackageReference Include="Microsoft.Azure.Management.Storage" Version="25.0.0" />
1919
</ItemGroup>
2020

src/IotHub/IotHub.Test/SessionRecords/Microsoft.Azure.Commands.IotHub.Test.ScenarioTests.IotHubDPConfigurationTests/TestAzureIotHubConfigurationLifecycle.json

Lines changed: 696 additions & 756 deletions
Large diffs are not rendered by default.

src/IotHub/IotHub.Test/SessionRecords/Microsoft.Azure.Commands.IotHub.Test.ScenarioTests.IotHubDPDeviceTests/TestAzureIotHubDeviceLifecycle.json

Lines changed: 1044 additions & 984 deletions
Large diffs are not rendered by default.

src/IotHub/IotHub.Test/SessionRecords/Microsoft.Azure.Commands.IotHub.Test.ScenarioTests.IotHubDPModuleTests/TestAzureIotHubModuleLifecycle.json

Lines changed: 863 additions & 803 deletions
Large diffs are not rendered by default.

src/IotHub/IotHub.Test/SessionRecords/Microsoft.Azure.Commands.IotHub.Test.ScenarioTests.IotHubDPTracingTests/TestAzureIotHubTracing.json

Lines changed: 220 additions & 280 deletions
Large diffs are not rendered by default.

src/IotHub/IotHub/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Updated IoT Hub Management SDK to version 4.2.0 (api-version 2021-07-02)
22+
* Fixed `Get-AzIoTHub` to work with DigiCert hubs
2123

2224
## Version 2.7.4
2325
* Updated IoT Hub Management SDK to version 4.1.0 (api-version 2021-07-10)

src/IotHub/IotHub/IotHub.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<ItemGroup>
1414
<PackageReference Include="Microsoft.Azure.Devices" Version="1.22.0" />
1515
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.27.0" />
16-
<PackageReference Include="Microsoft.Azure.Management.IotHub" Version="3.0.1" />
16+
<PackageReference Include="Microsoft.Azure.Management.IotHub" Version="4.2.0" />
1717
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="2.2.0" />
1818
</ItemGroup>
1919

src/IotHub/IotHub/IotHub/AddAzureRmIotHubCertificate.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ public override void ExecuteCmdlet()
142142
{
143143
certificate = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(certificate));
144144

145-
CertificateBodyDescription certificateBodyDescription = new CertificateBodyDescription();
146-
certificateBodyDescription.Certificate = certificate;
145+
CertificateProperties certificateProperties = new CertificateProperties();
146+
certificateProperties.Certificate = certificate;
147147

148148
CertificateDescription certificateDescription;
149-
certificateDescription = this.IotHubClient.Certificates.CreateOrUpdate(this.ResourceGroupName, this.Name, this.CertificateName, this.Etag, certificateBodyDescription.Certificate);
149+
certificateDescription = this.IotHubClient.Certificates.CreateOrUpdate(this.ResourceGroupName, this.Name, this.CertificateName, this.Etag, certificateProperties);
150150

151151

152152
this.WriteObject(IotHubUtils.ToPSCertificateDescription(certificateDescription));

src/IotHub/IotHub/IotHub/AddAzureRmIotHubEventHubConsumerGroup.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ public override void ExecuteCmdlet()
5555
string eventsEndpointName = "events";
5656
if (ShouldProcess(EventHubConsumerGroupName, Properties.Resources.AddEventHubConsumerGroup))
5757
{
58-
this.IotHubClient.IotHubResource.CreateEventHubConsumerGroup(this.ResourceGroupName, this.Name, eventsEndpointName, this.EventHubConsumerGroupName);
58+
EventHubConsumerGroupName properties = new EventHubConsumerGroupName(this.EventHubConsumerGroupName);
59+
this.IotHubClient.IotHubResource.CreateEventHubConsumerGroup(this.ResourceGroupName, this.Name, eventsEndpointName, this.EventHubConsumerGroupName, properties);
5960
IEnumerable<EventHubConsumerGroupInfo> iotHubEHConsumerGroups = this.IotHubClient.IotHubResource.ListEventHubConsumerGroups(this.ResourceGroupName, this.Name, eventsEndpointName);
6061
this.WriteObject(IotHubUtils.ToPSEventHubConsumerGroupInfo(iotHubEHConsumerGroups), true);
6162
}

src/IotHub/IotHub/Models/PSCapabilities.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ public enum PSCapabilities
2222
{
2323
None = 0,
2424
DeviceManagement = 1,
25-
GWV2 = 2
25+
GWV2 = 2,
26+
RootCertificateV2 = 3
2627
}
2728
}

0 commit comments

Comments
 (0)