Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Cannot create enrolment group with SDK - Unknown api version 2019-03-31 #3479

Closed
karpikpl opened this issue Dec 2, 2024 · 1 comment
Labels
bug Something isn't working.

Comments

@karpikpl
Copy link

karpikpl commented Dec 2, 2024

Context

  • OS, version, SKU and CPU architecture used: Ubuntu 22.04 x64
  • Application's .NET Target Framework : net8.0, net6.0
  • Device: Laptop
  • SDK version used: Microsoft.Azure.Devices.Provisioning.Service Version="1.18.4"

Description of the issue

SDK fails to create enrollment group, fails with error:

Unhandled exception. Microsoft.Azure.Devices.Provisioning.Service.ProvisioningServiceClientHttpException: Bad Request:{"Message":"ErrorCode:ArgumentInvalid;Unknown api version; uri: /enrollmentGroups/EnrollmentGroupSample-4e4d1d9b-a277-4e1e-852d-45c1b57de4b4?api-version=2019-03-31","ExceptionMessage":"Tracking ID:97740FBD6F1F40798788E0C30ED1BAC4-G2:-TimeStamp:2024-12-02T22:46:44.613378812Z"}

Looks like old API version is used? 2019-03-31 instead of 2021-10-01 https://learn.microsoft.com/en-us/rest/api/iot-dps/service/enrollment-group/create-or-update?view=rest-iot-dps-service-2021-10-01#symmetrickeyattestation

Code sample exhibiting the issue

Using code sample from this repository: https://github.com/Azure/azure-iot-sdk-csharp/blob/main/provisioning/service/samples/getting%20started/EnrollmentGroupSample/EnrollmentGroupSample.cs

Console log of the issue

➜  EnrollmentGroupSample git:(main) ✗ dotnet run -- -c "HostName=xxx"
Creating a new enrollment group...
Unhandled exception. Microsoft.Azure.Devices.Provisioning.Service.ProvisioningServiceClientHttpException: Bad Request:{"Message":"ErrorCode:ArgumentInvalid;Unknown api version; uri: /enrollmentGroups/EnrollmentGroupSample-4e4d1d9b-a277-4e1e-852d-45c1b57de4b4?api-version=2019-03-31","ExceptionMessage":"Tracking ID:97740FBD6F1F40798788E0C30ED1BAC4-G2:-TimeStamp:2024-12-02T22:46:44.613378812Z"}
   at Microsoft.Azure.Devices.Provisioning.Service.ContractApiHttp.ValidateHttpResponse(ContractApiResponse response)
   at Microsoft.Azure.Devices.Provisioning.Service.ContractApiHttp.RequestAsync(HttpMethod httpMethod, Uri requestUri, IDictionary`2 customHeaders, String body, String ifMatch, CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Provisioning.Service.EnrollmentGroupManager.CreateOrUpdateAsync(IContractApiHttp contractApiHttp, EnrollmentGroup enrollmentGroup, CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Provisioning.Service.Samples.EnrollmentGroupSample.CreateEnrollmentGroupAsync() in /home/pkarpala/projects/DOW/azure-iot-sdk-csharp/provisioning/service/samples/getting started/EnrollmentGroupSample/EnrollmentGroupSample.cs:line 35
   at Microsoft.Azure.Devices.Provisioning.Service.Samples.EnrollmentGroupSample.RunSampleAsync() in /home/pkarpala/projects/DOW/azure-iot-sdk-csharp/provisioning/service/samples/getting started/EnrollmentGroupSample/EnrollmentGroupSample.cs:line 23
   at Microsoft.Azure.Devices.Provisioning.Service.Samples.Program.Main(String[] args) in /home/pkarpala/projects/DOW/azure-iot-sdk-csharp/provisioning/service/samples/getting started/EnrollmentGroupSample/Program.cs:line 41
   at Microsoft.Azure.Devices.Provisioning.Service.Samples.Program.<Main>(String[] args)
@karpikpl karpikpl added the bug Something isn't working. label Dec 2, 2024
@karpikpl
Copy link
Author

karpikpl commented Dec 2, 2024

this was an issue with the connection string

@karpikpl karpikpl closed this as completed Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

1 participant