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

TenantResource.GetReservationOrders() not working for hybrid benefit reservation #3309

Open
2 of 9 tasks
RalfWenzel opened this issue Sep 12, 2023 · 0 comments
Open
2 of 9 tasks
Assignees
Labels
customer-reported question Further information is requested

Comments

@RalfWenzel
Copy link

Link to sample

https://learn.microsoft.com/en-us/rest/api/reserved-vm-instances/reservation/list?tabs=dotnet

Library name and version

Azure.ResourceManager.Reservations (1.3.0)

Language of the Sample

  • C#/.NET
  • Java
  • JavaScript/TypedScript
  • Python
  • Golang
  • Other - Please specify in Issue details field

Sample Issue Type

  • Sample not working
  • Sample missing
  • Do not understand sample

Issue details

  1. Outer loop -> GetReservationOrders: App gets all reservation orders, does some filtering
var orderCollection = tenantResource.GetReservationOrders().GetAllAsync();
await foreach (ReservationOrderResource orderResource in orderCollection)
{
   .......
}

=> working as expected.
2) Then, Inner loop: For all ReservationOrders returned , app gets all ReservationDetails

var reservationDetailCollection = orderResource.GetReservationDetails();
await foreach (ReservationDetailResource reservationDetailResource in reservationDetailCollection.GetAllAsync())
{
.......
}

=> working as expected for all ReservationOrders EXCEPT reservation is a Hybrid Benefit reservation. In this case an exception is thrown

Expected behavior

GetReservationDetails() working for all types of reservation

Actual behavior

If a reservation order is a hybrid benefit reservation an exception is thrown:

"Exception":"System.ArgumentException: Value cannot be an empty string. (Parameter 'resourceId')
   at Azure.Core.Argument.AssertNotNullOrEmpty(String value, String name)
   at Azure.Core.ResourceIdentifier..ctor(String resourceId)
   at Azure.ResourceManager.Reservations.Models.ReservationProperties.DeserializeReservationProperties(JsonElement element)
   at Azure.ResourceManager.Reservations.ReservationDetailData.DeserializeReservationDetailData(JsonElement element)
   at Azure.ResourceManager.Reservations.ReservationDetailCollection.<GetAllAsync>b__7_2(JsonElement e)
   at Azure.Core.PageableHelpers.PageableImplementation`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
   at Azure.Core.PageableHelpers.PageableImplementation`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
   at .... await foreach from inner loop above

** Note**: For all other reservations (78) everything works as expected => looks like deserializing this type of reservation fails

Reproduction Steps

For obvious reasons i cannot share credentials for TenantResource here..
But problem can be reproduced by using example code and only change:
Guid reservationOrderId = Guid.Parse("276e7ae4-84d0-4da6-ab4b-d6b94f3557da");
with a reservation order Guid that references a hybrid benefit reservation resource.

Environment

Linux Container on AKS
.NET Core 6.0 LTS
Visual Studio CE 2022, 17.6.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants