Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.57k stars 4.82k forks source link

[BUG] Billing Role Assignment deserialization fails when createdByPrincipalTenantId is empty #47341

Open noah-prosperops opened 4 days ago

noah-prosperops commented 4 days ago

Library name and version

Azure.ResourceManager.Billing 1.2.0

Describe the bug

When calling GetBillingProfileRoleAssignments().GetAllAsync() to list role assignments for a billing profile, we are observing in some environments an exception during this operation:

System.FormatException
One of the identified items was in an invalid format.

This occurs on this line in the SDK's deserialization of the createdByPrincipalTenantId property. It expects a GUID, but the value returned by API is actually an empty string in the failure scenario.

Expected behavior

The operation should always succeed for normal requests to the Azure API. In the case of an empty string for createdByPrincipalTenantId, the operation should complete and the result should reflect the actual value (we don't have an opinion on whether this would be empty GUID, null, or otherwise).

Actual behavior

System.FormatException is thrown with message One of the identified items was in an invalid format.

Reproduction Steps

Query an environment where role assignments exist with empty createdByPrincipalTenantId value. Perform SDK GetAllAsync() and observe the thrown exception.

Environment

.NET 8

jsquire commented 4 days ago

Thank you for your feedback. Tagging and routing to the team member best able to assist.